Open deckarep opened 5 years ago
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.
Since the empty struct is more compact.