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

Sven Barth pascaldragon at googlemail.com
Sat Apr 23 10:40:42 CEST 2022


Am 22.04.2022 um 23:08 schrieb Rainer Stratmann via fpc-pascal:
> Am Freitag, 22. April 2022, 19:53:34 CEST schrieben Sie:
>> Am 22.04.2022 um 15:48 schrieb Rainer Stratmann via fpc-pascal:
>>> Am Mittwoch, 20. April 2022, 19:15:15 CEST schrieb Sven Barth via fpc-
> pascal:
>
>> We don't deal in percentages, however it reduces the amount of typing
>> required to write code with a lot of specializations (in theory an IDE
>> like Lazarus *could* help here as well however).
> Of course 'you' do. When I asked for a simple feature years ago it was
> refused. And there were several explanations why this feature is not
> necessary.

I quickly checked the archives and found two suggestions by you:

1) "Name of a var" from 2011 ( 
https://lists.freepascal.org/pipermail/fpc-pascal/2011-November/031256.html 
)

2) "Declaration of arrays" from 2013 ( 
https://lists.freepascal.org/pipermail/fpc-pascal/2013-June/038496.html )

For 1) I'm still of the opinion that it would be useful especially 
considering that we now have {$I %CURRENTROUTINE%} as well.

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.

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.
Though contrary to your idea they don't provide an alternative way to 
specialize functions, but really provide a way to explicitely declare 
less. It's a real subtle difference between the two situations, but it's 
there.
The main argument however is Delphi compatibility. The amount of users 
that want features from Delphi is much higher than the amount of users 
that require features from MikroPascal and thus features that are 
syntactic sugar will see the light of day much easier.

Regards,
Sven


More information about the fpc-pascal mailing list