Hacker News new | ask | show | jobs
by axelf 4711 days ago
But since you have to use casts you are giving up some advantages of static typing, right?
1 comments

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?
No, unfortunately. It is proprietary.