[fpc-devel] Pascal Smart Pointers Idea + ARC implementation

Sven Barth pascaldragon at googlemail.com
Sat Oct 10 21:12:46 CEST 2015


On 10.10.2015 19:09, Maciej Izak wrote:
> 2015-10-10 18:40 GMT+02:00 Sven Barth <pascaldragon at googlemail.com
> <mailto:pascaldragon at googlemail.com>>:
>     While I see and understand your reasoning behind it I don't really
>     like it... There needs to be some better way for this... hmm... :/
>
> I am only sure about MANAGEMENTOPERATORS.
>
> instead of "default" field we can introduce:
>
> operator Dot: T;
> operator Dereference: T;
> operator Addr: T;
> operator DoubleAddr: T;
> operator DefaultImplicit: T;
> operator TypeInfo: PTypeInfo;
>
> but this solution is much slower. btw. we can introduce also this
> operators for better control of "default" field. (all of above operator
> have higher priority than "default" field and "default" field has bigger
> priority than class operator).

They don't necessarily need to be slower. If you declare them as 
"inline" then the compiler will indeed inline them if it sees the 
potential for it.
(Sidenote: non-Delphi modes should use the operator symbols, namely ".", 
"^", "@" and "@@" (though I have to admit that I don't know where you 
got that @@ from; was that introduced in Delphi recently?)).

It's not an easy topic and I'd really welcome the input of other core 
developers...

Regards,
Sven



More information about the fpc-devel mailing list