3 ms·
But since you have to use casts you are giving up some advantages of static typing, right?
by axelf 13y ago
But since you have to use casts you are giving up some advantages of static typing, right?
- mratzloff 13y agoYes, 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.