[fpc-devel] Getting built-in string type

Ryan Joseph 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.


For example:

generic procedure DoThis<T>(msg: T);
begin
end;

var
	a: array of char;
begin
	DoThis(a);


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.

Regards,
	Ryan Joseph




More information about the fpc-devel mailing list