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

Hairy Pixels genericptr at gmail.com
Mon Apr 25 11:48:41 CEST 2022

> On Apr 25, 2022, at 4:11 PM, Sven Barth <pascaldragon at googlemail.com> wrote:
> Then you don't think creative enough. Think about (de)serialization code for binary data which needs to use the correct size. If done correctly this can very well be handled with a generic. 

Oh yes that’s right. I guess I would need some real examples of a function that used type information and could suffer a failure by the compiler assuming the wrong type from a constant like “1”. If you were deserializing you would probably be passing in a very particular type and not some ambiguous thing like a number literal.

Having said that there should be type restrictions for Integer, Real, Boolean and String (maybe Char) etc… Right now only class, record and interface are supported.

	Ryan Joseph

More information about the fpc-pascal mailing list