[fpc-devel] Feature announcement: Record management operators

Jonas Maebe jonas.maebe at elis.ugent.be
Mon Mar 7 15:56:56 CET 2016


Michael Van Canneyt wrote on Mon, 07 Mar 2016:

> On Mon, 7 Mar 2016, Jonas Maebe wrote:
>
>> The syntax with the separate "var aFoo: TFoo" parameter, but then  
>> seemingly using that parameter as some kind of automatic alias for  
>> a fake "self" in the body, is also rather strange (why don't you  
>> have to use "aFoo.F := 10" etc?)
>
> Exactly my question. I think it would have been preferable to drop  
> the parameter and simply introduce
> 'self' ?

No, since as Maciej remarked, a class operator is always a static  
method. Introducing conventions or behaviours for this class operator  
that are different compared to those of other class operators would  
not be a good idea (even if it would result in slightly less typing --  
you can always add a "with" block if you want to avoid that :)

> The current solution seems quite counter-intuitive.

Definitely.


Jonas



More information about the fpc-devel mailing list