For conversion from starlight Set to native Go map use map[interface{}]struct{}
Opened this issue · 1 comments
deckarep commented
Since the empty struct is more compact.
natefinch commented
Yeah, I've gone back and forth... in real use, I don't think size really matters unless you're making a gigantic set... my main concern is usability, and plain bools are easier to work with than struct{}.
// this is easier and nicer
set["foo"] = true
exists := set["foo"]
// this is more compact, but ugly
set["foo"] = struct{}{}
_, exists = set["foo"]
I'll keep this open for now to have other people weigh in on it, but I don't think it really matters either way.... and bool is slightly easier to read IMO.