[fpc-devel] "Default" discussion for SmartPointers etc

Michael Van Canneyt michael at freepascal.org
Thu Jul 28 08:21:28 CEST 2016



On Wed, 27 Jul 2016, Jonas Maebe wrote:

> On 27/07/16 22:47, Sven Barth wrote:
>> Am 27.07.2016 21:04 schrieb "Maciej Izak" <hnb.code at gmail.com
>> <mailto:hnb.code at gmail.com>>:
>>> 
>>> 
>>> 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();
>
> What is the basic purpose? I did not see any explanation of that in the 
> original mail. It only said that it is vital to the smart pointers/ARC 
> objects and nullable types implementation.

As far as I understand I think Izak wants (needs) 2 things:

- "Default" property for a property of records.
   I think that this feature by itself presents little difficulty.

   This is enough to implement "nillable" types, except for 1 thing.
   (second point)

- The ability to pass properties as var arguments.

   I think this feature is not doable. The closest you can come to this is:

   tmp:=A.Prop;
   try
     MyProcedureVarArgument(tmp);
   finally
     A.Prop:=Tmp;
   end;

   But this presents obvious timing problems: A.Prop is written only on return of the function.

   Failing that, Izak tries to simulate the 'address' of the default property
   of a record.

IMHO The first can be done, the solution to the second is a bad idea.

Michael.



More information about the fpc-devel mailing list