4 ms·
The structs used as ‘class instaces’ aren’t statefull. The compiler will actually optimise out the ‘default’ also, so it’s as efficient as calling a static met
by louthy 9y ago
The structs used as ‘class instaces’ aren’t statefull.
The compiler will actually optimise out the ‘default’ also, so it’s as efficient as calling a static method.
Anyway, nobody is arguing that this is some perfect system, merely that return type polymorphism can be achieved _relatively_ painlessly in a language other than Haskell.