[fpc-pascal] Procedural parameters
Sven Barth
pascaldragon at googlemail.com
Sun Dec 15 17:14:14 CET 2024
Am 15.12.2024 um 01:58 schrieb Hairy Pixels via fpc-pascal:
> Forcing function types and pointers to be type declaration only is now
> a limitation for generic procedures and should be reversed. No reason
> to be following what some Borland engineer was doing in the 80’s when
> it’s 2024.
>
> procedure DoThis<T>(param: ^T);
> procedure DoThis<T>(param: function(a, b: T): Boolean);
The point is that Object Pascal defines that function parameters and
result types can only be named types. A use of type definitions would
mean that the declaration in the interface section would be different
from the one in the implementation section, because that is how Object
Pascal works.
Not to mention that changing this would lead to conflicts with the
syntax for open arrays and dynamic arrays.
Regards,
Sven
More information about the fpc-pascal
mailing list