[fpc-devel] Generic helper questions
Hairy Pixels
genericptr at gmail.com
Mon May 23 03:41:39 CEST 2022
Over the weekend I did some work on how to implement generic helpers since this is something I wanted to do for a while and Sven said it was on the agenda. It’s "low hanging fruit” kind of feature since all the pieces are there (helpers and generics) just not put together, kind of multi helpers were.
The only question I have is how to deal with anonymous types and specialized types which are being extended. For some reason they were disabled with helpers but I think it makes sense to allow at least a limited set.
- For type helpers I think the most important type to support is dynamic arrays but probably sets also, i.e. "type helper for array of T” or "type helper for set of T”.
I know more could be supported like pointers "type helper for ^T”, which seems kind of reasonable although I can’t really think of a purpose. I don’t have any academic reason but dynamic arrays and sets are fundamental and singular (even though compound) compiler types the user would want to extend. This doesn’t apply to say some anonymous record.
- Second thing which should be supported are specialized types like “class helper for specialized TMyClass<T>”. This is important so that generic classes themselves can have generic helpers which extend them. Currently any inline specialized type is blocked in helpers for some reason unknown to me but we should lift that restriction for generic helpers.
That’s what I have so far. Let me know what can be done about those things so I can move forward. Thank you.
Regards,
Ryan Joseph
More information about the fpc-devel
mailing list