[fpc-pascal] Multiple active class helpers at same time

Michael Van Canneyt michael at freepascal.org
Mon Apr 23 15:16:35 CEST 2018



On Mon, 23 Apr 2018, Marco van de Voort wrote:

> In our previous episode, Maciej Izak said:
>> 
>> full potential of class/record/type helpers is not used :), and by bad
>> choice can be loses for ever. IMO The best direction for type helpers
>> (which can solve all problems) is usage "with" for example:
>> 
>> var
>>   x: TObjectA with THelper1, THelper2;
>> 
>> AFAIK should be possible to create new sub kind of helpers : aspects with
>> new syntax and functionalities. IIRC Sven did not want to use "with" just
>> for "type helpers" because it is reserved for more amazing feature like
>> "aspects", but when type helper has the same root as aspect (aspect as sub
>> kind of helper) then "with" can be used for both : "type helpers" and "type
>> aspects"
>
> IMHO having to change every reference/declaration kind of the defeats the
> purpose of helpers a bit.

True if you don't want to use a local variable, but I think the idea has merit
in the sense that you can be very explicit about what type helpers you want
in case of doubt. If it is an optional syntax, I don't see why not.

Michael.


More information about the fpc-pascal mailing list