Re:Impressions of Go
by axelf on Tuesday July 23, 2013 @01:16PM
(#6091419)
But since you have to use casts you are giving up some advantages of static typing, right?
[ Parent
| on HN ]
Yes, but the `container/list` standard library uses the same approach.
I wrote a Cartesian product library that took a different tack--it splits the index and iterator cursor logic (integer fiddling) into one struct and the actual type into another, so it's easy to build type-checked objects.
In full disclosure, though, that was mainly because the alternative (using `interface{}`) was so utterly painful.
That sounds interesting and useful. Is that code publically available anywhere?