ref on hidden this param

TwoOfCups TwoOfCups at notreal.com
Sun Oct 5 06:49:16 UTC 2025


On Sunday, 5 October 2025 at 05:58:10 UTC, Richard (Rikki) Andrew 
Cattermole wrote:
> On 05/10/2025 6:55 PM, TwoOfCups wrote:
>> 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..
>
> A small example of this, where the proposed feature is used 
> would be very welcome.
>
> I'm having trouble picturing the types and their interaction to 
> each other.

```
class C {
         int uuid;
	int toSerial(){ // int is the proxy type
		return uuid;
	}
	void fromSerial(int i){
	        // do uuid lookup and assign this if this could be ref
	}
}

...

during serialization check if type has a toSerial and call that 
instead of serialized directly, in this case uuid will be written 
instead of the class contents. the actual class contents will be 
serialized else where
```


More information about the Digitalmars-d mailing list