Re:What else is in Go 1.11?
by zlynx on Thursday August 16, 2018 @02:38PM
(#17777388)
It seems to me that's just a map[set_key]bool
[ Parent
| on HN ]
1. because you can't build opaque abstractions in Go, you have to wonder if there's a difference between having a true and a false value mapped to a key
2. because sets are significantly less useful without set-operations (intersections, unions, differences) and since go does not have user-defined generics you can't build a generic version of those (
3. because it wastes 1 byte per item (according to the comments in bmap, buckets are implemented column-major
`map[K] struct{}` would fix 3 and the second half of 1 (struct{} is a zero-sized singleton) but is somewhat less ergonomic so the impact of what's left of 1 is worse, and it doesn't solve 2 at all