[fpc-pascal] Constants in generics
Ryan Joseph
ryan at thealchemistguild.com
Wed Nov 28 09:10:43 CET 2018
I just noticed I sent this to the wrong person and the list never saw it so I’m sending it again. I feel like I should try to fix it while I’ve got my eyes on the generics code before I forget.
Is there a reason it’s not implemented yet? In theory you should be able to specialize a function as a type and use the type name as the function name. This is basically the same syntax for class construction but without the .create.
====================
As a side node I haven’t been willing to use generic functions yet because the syntax is so verbose it kind of defeats the purpose.
Why can’t we specialize functions as a type? Maybe that’s on the todo list also?
generic procedure DoThis<T>(msg:string);
begin
writeln(msg, ' ',sizeof(T));
end;
type
DoInt = specialize DoThis<integer>;
begin
DoInt(‘hello');
Regards,
Ryan Joseph
More information about the fpc-pascal
mailing list