On 11/29/2026 07:25 PM, Bonita Montero wrote:
> Am 29.11.2026 um 23:45 schrieb Dan Cross:
>
>> It's actually not even that hard. Most class instances have a
>> single pointer to a vtbl; you can "monkey patch" C++ just by
>> replacing that with a pointer to a different table that points
>> to a different thunk.
>
> It is hard since a different class has a different object layout
> with different state.
C++ since "move semantics" which used to be called "re-seating the
reference", which wasn't itself a thing in the language, since nothing's
to actually "move" except the pointer, about "returning references" to
values that don't exist when they're return-results instead of
temporary-results, has that "move semantics" then about "ref" and
"ref-ref" both conflating return-results and temporary-results, then
"splitting into another dialect the templates" the
"forwarding-reference" and "universal-reference" and doing the
"overloading const", seems a bit the "primrose path" and not all would
suggest it.
Usual ideas of "multiple-inheritance is hard" also makes for
"multiple-inheritance breaks monkey-patching".
The "smart-pointer" then about how to make for "depth-count"
past "ref-count" on the smart-pointer, not a shared-pointer just
a passed-pointer, is a page or so of code. Of course C++ was
written with smart-pointers before move-semantics for a perceived
"simplicity's" sake basically conflated lifetime with scope.
C then is for that pointers then layers of pointer-indirection,
have that "**" is basically at least two different types according
to whether it's a return-result (an out-parameter) or a
temporary-result, _or_, for example, where it's "pointer in front of
array so pointer-decay of types results array of fixed-length".
The "smart-pointer" then for a "smart-depth-pointer", basically
involves in C++ an object to access the smart-depth-pointer,
so the object lives according to block/function scope and then
as for it being surfaced, has that it either lives on the heap
or it doesn't.
Or, "the move-semantics the syntactic-sugar is a bit the bitter-pill".