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

Hairy Pixels genericptr at gmail.com
Sat Apr 23 16:09:05 CEST 2022

> On Apr 23, 2022, at 3:40 PM, Sven Barth via fpc-pascal <fpc-pascal at lists.freepascal.org> 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…

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

	Ryan Joseph

More information about the fpc-pascal mailing list