[fpc-devel] Additional generic type constraints

Hairy Pixels genericptr at gmail.com
Wed Feb 22 14:30:35 CET 2023



> On Feb 22, 2023, at 8:11 PM, Sven Barth via fpc-devel <fpc-devel at lists.freepascal.org> wrote:
> 
> Some additional constraints might be added. However I have none of them planned currently and enough other things to do. 
> 

I think Delphi basically has the same constraints as C# so FPC is in that same category. Swift has additional constraints for compiler types but I think they can pull that off because they have protocols such as “Numeric” which can be used on integer and floating point types.

It does seem incomplete that you can’t make a generic constrained for string types for example. Why don’t more languages have that? It seems like an obvious feature which should be supported.

Regards,
Ryan Joseph



More information about the fpc-devel mailing list