ref on hidden this param

TwoOfCups TwoOfCups at notreal.com
Sun Oct 5 05:55:17 UTC 2025


On Sunday, 5 October 2025 at 05:45:19 UTC, Richard (Rikki) Andrew 
Cattermole wrote:
> On 05/10/2025 6:39 PM, TwoOfCups wrote:
>> On Sunday, 5 October 2025 at 05:35:24 UTC, Richard (Rikki) 
>> Andrew Cattermole wrote:
>>> On 05/10/2025 6:28 PM, TwoOfCups wrote:
>>> This cannot work.
>>>
>>> Methods are stored in the vtable which is accessed from the 
>>> this pointer.
>>>
>>> You would be jumping to a function pointer which is acquired 
>>> after a null dereference.
>> 
>> ok so mark it final, still i think such a thing would be useful
>
> This is indeed possible.
>
> Walter would like to make the this pointer optionally explicit.
>
> However to support ref on it, there should be reasoning beyond 
> "it could be useful".

Well in my case I am wanting it for a specific templated 
serialization scenario where the serializer has the ability to 
use a proxy type to serialize as a proxy type instead of 
serializing it directly. And i was wanting to serialize objects 
as a uuid and on deserialization do a look up to find it but 
would need to reassign the lvalue to make it work..

i will probably figure out some other way to do it but it will 
just make my serialization code more complicated and its already 
very complicated..

so "it could be useful" is all i got for you cus its what 
prompted me to make this thread.


More information about the Digitalmars-d mailing list