[fpc-pascal] Record helper properties

Michael Van Canneyt michael at freepascal.org
Wed Apr 24 08:27:13 CEST 2019



On Tue, 23 Apr 2019, Ryan Joseph wrote:

>
>
>> On Apr 23, 2019, at 5:32 PM, Michael Van Canneyt <michael at freepascal.org> wrote:
>> 
>> That should be obvious:
>> 
>> Because a helper can only add methods to a type, not additional storage
>> space (memory). The basic type determines the memory layout of the data. A helper cannot change that.
>> 
>> Michael.
>
> I mean for properties though so it’s not actually adding a type, just making an alias:
>
> property F: integer read x;
>
> that should just map “x” to “F”, right? I’m getting an error on this however.

I would think this should be allowed, yes. I see no reason to disallow it.

That said, I see also no reason why on earth you would want to add this, as you can
just access x ? The only sensible addition would be using a getter/setter,
to do some kind of check or transformation.

Michael.


More information about the fpc-pascal mailing list