[fpc-pascal] with in classes/records

Michael Van Canneyt michael at freepascal.org
Mon Sep 3 18:35:46 CEST 2018



On Mon, 3 Sep 2018, Ryan Joseph wrote:

>
>
>> On Sep 3, 2018, at 9:17 PM, Martin <fpc at mfriebe.de> wrote:
>> 
>> No it is not the same.
>> 
>> You.f.Free;
>> will always work, it is not ambiguous.
>> 
>> You.Free;
>> depends on no method Free being declared on the class of You, or any of its base classes, or any other default class (if more than one is allowed) that would be searched at higher priority.
>> 
>> You.Free;
>> has a risk, of suddenly and expectingly doing something else. Therefore it is not the same.
>> It does however take the same action, if and only if there is no other Free, but the one you wanted.
>
> I mean given that exact configuration calling Free arrives at the same location so it’s “the same”. The reason we made the default property was to *omit* the name of the property AND the name of the field it references.

The point is that there are situations where you need this name. 
Martin demonstrated this clearly.

So it must be specified in the declaration.

Michael.


More information about the fpc-pascal mailing list