C++ Logo

std-proposals

Advanced search

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

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Sat, 30 Jul 2022 17:12:59 -0400
On Sat, Jul 30, 2022 at 3:53 PM Frederick Virchanza Gotham via
Std-Proposals <std-proposals_at_[hidden]> wrote:
>
> 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.

That would mean you could modify the behavior of every instance of a
class without that class's express permission. Regardless of
everything else, I'd call that a non-starter.

> 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".

OK: why do we need that?

Received on 2022-07-30 21:13:11