[fpc-pascal] Constants in generics

Ryan Joseph ryan at thealchemistguild.com
Thu Jan 3 23:14:57 CET 2019



> 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.

Regards,
	Ryan Joseph




More information about the fpc-pascal mailing list