Am Mi., 28. Nov. 2018, 09:41 hat Ryan Joseph <r...@thealchemistguild.com> geschrieben:
> 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? > Because that is not supposed to work. Generic routines are *routines*, not types. You can't define aliases for routines either, not to mention the problems with scoping as generic methods exist as well. Generic routines however have a different boon in Delphi that I plan to add as well: inference of the type parameters based on the parameters the user passed. In that case the type parameter clause as well as the "specialize" in non-Delphi modes would not need to be used and it would look like a normal, non-generic call. Regards, Sven >
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal