[fpc-pascal] Feature announcement: implicit generic function specializations

Hairy Pixels genericptr at gmail.com
Mon Apr 25 10:51:34 CEST 2022



> On Apr 25, 2022, at 2:39 PM, Martin Frb via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
> 
> Actually, it's dealing with SmallInt (or ShortInt). And if the programmer does not know that, then it might be an issue...
> 
> Imagine the generic code (something more complex than "Add") would somehow do something that differs for SmallInt and Integer. Like using "SizeOf(T)".

This is almost a case that requires better type restrictions. If your generic function relies specifically on some particular type information this is almost not really even a good candidate to be generic at all. 

Regards,
	Ryan Joseph



More information about the fpc-pascal mailing list