C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Versatility -- Classes change at runtime

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Sat, 30 Jul 2022 20:53:20 +0100
On Sat, Jul 30, 2022 at 8:19 PM Bo Persson via Std-Proposals
<std-proposals_at_[hidden]> wrote:
<snip>
> > I wonder if we can take classes to the next level of versatility by no
> > longer requiring the v-table to be a compile-time constant?
<snip>
>
> Why?
>
> You *could* have a data member, and change that. Doesn't require a
> language change.


With this language change, there would be no change required to the
header and source files for the class whose V-Table you're editing.

You would however need to re-compile the class with extra compiler
options to specify that the pointers in the V-Table are:
(1) atomic
(2) must not be cached
(3) stored in writeable memory

Something like:

        g++ -o program source.cpp --atomic-vtables-writeable-no-cache

If you've already been given a pre-compiled shared library for the
class, e.g. "SomeClass.so.1" or "SomeClass.DLL" then this won't work.

What I'm doing here is trying to come up with ways of really expanding
on what we mean by "polymorphic". More of a thought experiment than
anything else. Poke out at the boundaries of how we currently think.

Received on 2022-07-30 19:53:30