<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">2016-07-27 15:33 GMT+02:00 Jonas Maebe <span dir="ltr"><<a href="mailto:jonas.maebe@elis.ugent.be" target="_blank">jonas.maebe@elis.ugent.be</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">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]").</blockquote></div><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();</div><div class="gmail_extra"><br></div><div class="gmail_extra">To get rid of @@/@@@ we can use typecast + new type kind. With "proxy" type, Sven proposition has more sense:</div><div class="gmail_extra"><br></div><div class="gmail_extra">=== code begin ===</div><div class="gmail_extra"><div class="gmail_extra">{$MODE DELPHI}</div><div class="gmail_extra"><br></div><div class="gmail_extra">type</div><div class="gmail_extra"> TRawSomeSmart<T> = record</div><div class="gmail_extra"> private</div><div class="gmail_extra"> Instance: T;</div><div class="gmail_extra"> ... // normal record</div><div class="gmail_extra"> end;</div><div class="gmail_extra"><br></div><div class="gmail_extra"> TSomeSmart<T> = proxy to TRawSomeSmart<T>.Instance;</div><div class="gmail_extra"><br></div><div class="gmail_extra">var</div><div class="gmail_extra"> ptr: pointer;</div><div class="gmail_extra"> // PTypeInfo(TypeInfo(ni)).Kind = tkProxy</div><div class="gmail_extra"> ni: TSomeSmart<Integer>;</div><div class="gmail_extra"> np: TSomeSmart<TProcedure>;</div><div class="gmail_extra">begin</div><div class="gmail_extra"> ptr := @ni; // pointer to ni.Instance</div><div class="gmail_extra"> ptr := @TSomeSmart<Integer>(ni); // pointer to ni</div><div class="gmail_extra"><br></div><div class="gmail_extra"> ptr := @@np; // pointer to np.Instance</div><div class="gmail_extra"> ptr := @np // pointer to procedure</div><div class="gmail_extra"> ptr := @TSomeSmart<TProcedure>(np); // pointer to np</div><div class="gmail_extra">end;</div><div><div class="gmail_extra">=== code end ===</div><div class="gmail_extra"></div></div><div class="gmail_extra"><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>Best regards,<br>Maciej Izak</div></div></div>
</div></div>