Re:Generics aren't ready for Go
by weberc2 on Monday February 18, 2019 @10:05AM
(#19191091)
To be clear, you use cheap type assertions to get a well-typed value back out. You can use expensive operations from the `reflect` library to do other things, but not to get a well-typed value back out.
[ Parent
| on HN ]
Re:Generics aren't ready for Go
by rebeccaskinner on Monday February 18, 2019 @10:41AM
(#19191420)
Looking at some benchmarks it does look like newer versions of Go at least have pretty reasonable performance for type assertions. That makes the situation a little less bad, but doesn't negate the general ugliness of having type assertions every time you want to get a value back out of a generic data structure.