Use {$mode delphi} instead may work, but it would be Delphi incompatible, because Delphi does not support that at all.
Not only do the syntax between objfpc and delphi differ (specialize), objfpc can do way more.
What is your problem with specialize? It gives you a wider range of opportunities...
specialize is fine I guess if I only use it once. Yeah, it is more obvious which one you are getting.
If more than than once might be more verbose (or less..., depends) than my empty record example.
I guess one would assume that
specialize used more than once for the same type would result in only one instance for that type.
With my empty record example I know how to pre
specialize once and use many times.
The question was can I pre
specialize once and use many times when just using a generic function/procedure that has not been wrapped as a static class member in an empty record.
But, that could just be eye-candy as you often point out, and may not be the best way to go about it...