Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

But since you have to use casts you are giving up some advantages of static typing, right?


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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: