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

Marco van de Voort fpc at pascalprogramming.org
Sat Apr 23 17:30:04 CEST 2022


On 23-4-2022 16:09, Hairy Pixels via fpc-pascal wrote:
>> For 2) I'm also of the opinion of the others: this is unneeded syntactic sugar. There is already a way to declare arrays with a specific size and for a language it's in nearly all cases not good to provide multiple ways to achieve the same.
> Getting off topic but personally I think the idea of a range bound for arrays has been proven to be a bad idea from the original Pascal spec. Originally when learning pascal I think I did 1 indexed arrays but eventually realized it’s non-standard across other languages and doesn’t really provide any use. In 99.99% of cases I always do 0…n so it’s just wasting time at this point. In fact I would be really hard pressed to think of a time I did something besides 0…n…

0..n-1  I might hope.

Btw since you are afaik an Apple user, did you actually use conformant 
arrays, or do you base this on UCSD/Borland dialects only?

>> As I've written elsewhere: implicit function specializations as a feature might not have happened if Delphi did not support them as well, cause like 2) they are essentially syntactic sugar as well.
> The two languages I use commonly these days are Swift and C#, both of which do implicit function specialization by default. After you use a generic function a couple times it becomes apparent the compiler could infer the types and it’s less code to write so it’s natural that any language that has generic functions would support this feature.

IMHO It is like with all shorthands, if an addition causes pitfalls, 
debugging those is usually worse then they ever save.

I've no idea about how that is with this feature (and then most notably 
the integration in the Pascal language, since pitfalls are often due to 
combinations of features)



More information about the fpc-pascal mailing list