<p>Am 27.07.2016 21:04 schrieb "Maciej Izak" <<a href="mailto:hnb.code@gmail.com">hnb.code@gmail.com</a>>:<br>
><br>
><br>
> 2016-07-27 15:33 GMT+02:00 Jonas Maebe <<a href="mailto:jonas.maebe@elis.ugent.be">jonas.maebe@elis.ugent.be</a>>:<br>
>><br>
>> It would seem better to me that you do have to add something after your proxy object (specify a field, call a method, use proxyobject[x], ...) to get the proxied value. Just like with a class, where "instance" by itself can never refer to the default property (it's always "instance[x]").<br>
><br>
><br>
> In that case SmartPtr/SmartObj/Nullable type has no sense for me. The basic purpose is excluded. You can do that today by using for example proxyobject._.foo();<br>
><br>
> To get rid of @@/@@@ we can use typecast + new type kind. With "proxy" type, Sven proposition has more sense:<br>
><br>
> === code begin ===<br>
> {$MODE DELPHI}<br>
><br>
> type<br>
> TRawSomeSmart<T> = record<br>
> private<br>
> Instance: T;<br>
> ... // normal record<br>
> end;<br>
><br>
> TSomeSmart<T> = proxy to TRawSomeSmart<T>.Instance;<br>
><br>
> var<br>
> ptr: pointer;<br>
> // PTypeInfo(TypeInfo(ni)).Kind = tkProxy<br>
> ni: TSomeSmart<Integer>;<br>
> np: TSomeSmart<TProcedure>;<br>
> begin<br>
> ptr := @ni; // pointer to ni.Instance<br>
> ptr := @TSomeSmart<Integer>(ni); // pointer to ni<br>
><br>
> ptr := @@np; // pointer to np.Instance<br>
> ptr := @np // pointer to procedure<br>
> ptr := @TSomeSmart<TProcedure>(np); // pointer to np<br>
> end;<br>
> === code end ===</p>
<p>Hmm, not that bad either. At least then it would be absolutely clear that TSomeSmart is something special and not an ordinary record.</p>
<p>Regards,<br>
Sven</p>