3 ms·
And I'd say the biggest uncovered useful use case is type-safe containers that aren't slices, arrays, or maps. For that, my current preferred approach is to wr
by ansible 12y ago
And I'd say the biggest uncovered useful use case is type-safe containers that aren't slices, arrays, or maps.
For that, my current preferred approach is to wrap a generic implementation (using interface{}) with a concrete type. Like this:
http://play.golang.org/p/LkVWkyph75 http://play.golang.org/p/LkVWkyph75
There is some boilerplate code needed for each concrete type, but it is relatively small and easy to verify.
- pjmlp 12y agoJust like Java, Object Pascal, Oberon and C++ back in the old days...