[fpc-pascal] Constants in generics

Sven Barth pascaldragon at googlemail.com
Fri Jan 4 07:11:22 CET 2019


Am 03.01.2019 um 23:14 schrieb Ryan Joseph:
>
>> On Jan 3, 2019, at 11:33 AM, Sven Barth via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
>>
>> The approach should be like this:
>> - const is allowed at the start of the parameters or after a ";"
>> - a parameter name is either followed by a ",", ";", ":" or ">" (that should already be the case)
>> - a ":" is either followed by a type constraint (for non const parameters) or a type name that allows constants (for const parameters); in either case this is followed by a ";" or the closing ">"
>>
>> I think that should cover everything 🤔
>>
> Ok, I’ll try to change that later since it’s minor.
>
> I read your old email about removing “tgenericparamdef”: quote from you: "Looks better.
> The next thing to nuke is the tgenericparamdef. The parameters stored in tdef.genericparas are the parameter symbols, so there should be no need for defs. If necessary some of the code in pgenutil (and related functions) will need to be changed from handling a list of defs to a list of syms.”
>
> You’re probably right that’s better design but that means I need to overhaul a rather fundamental element of how generics were designed and goes well outside the changes I made. At the core of the problem is tspecializationcontext.genericdeflist contains tdef’s and changing that to symbols means I need to rename lots of variables, move methods from tstoreddef and all the other various places where types were used. Sorry but there’s just not enough time for me to dive into that right now so that will have to wait.
Fair enough. In that case support for constants in generics will have to 
wait as well. 🤷‍

Regards,
Sven



More information about the fpc-pascal mailing list