[fpc-devel] Additional generic type constraints

2023-02-18 Thread Hairy Pixels via fpc-devel
As a follow up to my other question, why doesn’t FPC support more types for generic type constraints, like Pointer, Integer, String etc...? Especially since we have implicit function specialization now allowing the user to constrain the types more precision would help. For example my other prob

Re: [fpc-devel] Additional generic type constraints

2023-02-20 Thread Sven Barth via fpc-devel
Hairy Pixels via fpc-devel schrieb am So., 19. Feb. 2023, 03:54: > As a follow up to my other question, why doesn’t FPC support more types > for generic type constraints, like Pointer, Integer, String etc...? > Especially since we have implicit function specialization now allowing the > user to c

Re: [fpc-devel] Additional generic type constraints

2023-02-22 Thread Kostas Michalopoulos via fpc-devel
Because Delphi doesn't have them and when constraints were implemented they were implemented for Delphi compatibility. Can they be added? The original announcement ~13 years ago mentioned that those could be added at some point. "object" and "operator X" would be quite useful for me. I tried

Re: [fpc-devel] Additional generic type constraints

2023-02-22 Thread Sven Barth via fpc-devel
Kostas Michalopoulos via fpc-devel schrieb am Mi., 22. Feb. 2023, 10:37: > > Because Delphi doesn't have them and when constraints were implemented > > they were implemented for Delphi compatibility. > > Can they be added? The original announcement ~13 years ago mentioned > that those could be ad

Re: [fpc-devel] Additional generic type constraints

2023-02-22 Thread Hairy Pixels via fpc-devel
> On Feb 22, 2023, at 8:11 PM, Sven Barth via fpc-devel > 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

Re: [fpc-devel] Additional generic type constraints

2023-02-22 Thread denisgolovan via fpc-devel
> 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. Rust & Haskell do that. But that's another story :) -- Regards, Denis Golovan

Re: [fpc-devel] Additional generic type constraints

2023-02-22 Thread Stefan Glienke via fpc-devel
> I think Delphi basically has the same constraints as C# Not quite (well maybe back then when they implemented them but C# improved since)- also they are subtly implemented differently. In C# the constraint *class* means "a reference type" - in Delphi it actually means it has to be a class. C

Re: [fpc-devel] Additional generic type constraints

2023-02-23 Thread Kostas Michalopoulos via fpc-devel
On 2/22/23 15:11, Sven Barth wrote: Kostas Michalopoulos via fpc-devel > schrieb am Mi., 22. Feb. 2023, 10:37: > Because Delphi doesn't have them and when constraints were implemented > they were implemented for Delphi compatibility. Can

Re: [fpc-devel] Additional generic type constraints

2023-02-23 Thread Hairy Pixels via fpc-devel
> On Feb 22, 2023, at 8:11 PM, Sven Barth via fpc-devel > wrote: > > Some additional constraints might be added. However I have none of them > planned currently and enough other things to do. Btw, which constraints were you considering? Regards, Ryan Joseph _