[fpc-devel] Getting built-in string type
ryan at thealchemistguild.com
Sat Mar 2 21:37:46 CET 2019
I’ve looked into this more today and I don’t see how we can get around needing a typesym for specializations.
generic procedure DoThis<T>(msg: T);
a: array of char;
Is going to specialize as DoThis<array of char>(a). “array of char” is (for lack of the proper term) an anonymous dynamic array and would be not a valid specialization unless an explicit type was declared.
For strings I figured out I could use the built-in system type “cshortstringtype” if is_chararray() return true (for specializing string constants like in my initial question) but that is specific to string constants.
For normal function calls this isn’t a problem because the type is always specified but for implicit specializations the type may need to be declared in order for the specialization to be possible.
More information about the fpc-devel