|
|
|
|
|
by tomp
4290 days ago
|
|
What I meant is, "better or equal to current Go code using the current version of polymorphism (which is `interface {}`)". AFAIK it's not possible to write generic Go code without `interface {}` (or, alternatively, duplicating the code for each type). |
|
`interface{}` is very rarely used for writing "generic" code precisely because of its lack of type safety and performance implications. If you came up with a way to make it type safe without addressing performance, you've just implemented a generics scheme that will cause programs to be slower than they would be without generics (because people would start using them!).