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

Sven Barth pascaldragon at googlemail.com
Fri Apr 22 23:17:18 CEST 2022


Am 22.04.2022 um 22:22 schrieb Mattias Gaertner via fpc-pascal:
> On Fri, 22 Apr 2022 20:51:56 +0200
> Martin Frb via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
>
>> [...]
>> Well, I tested: It uses the type of the first Param. So it calls a
>> function for both param of type Byte. The cardinal argument is
>> converted. (potentially truncated).
> I agree that Delphi should have used a better algorithm, like checking
> the var/out arguments first and otherwise use the smallest
> integer that fits all related params. Same for strings and boolean.
> pas2js uses a similar algorithm.

Considering that we're talking mainly about differences of width and 
precision (e.g. the differences between a string and a record are more 
clear) this can probably be improved without considering Delphi here, 
because this is nowhere documented... (our non-generic overload 
selection might lead to different results after all as well) But even if 
we only improve this for non-Delphi modes I agree that a suggestion like 
yours would be an improvement.

Regards,
Sven


More information about the fpc-pascal mailing list