Hash tables in Go and advantage of self-hosted compilers

23 points by runxiyu


tomsmeding

Using empty structs also hurts readability.

Does it? Sure, struct{} is a little longer than bool and has more symbols in it, but it conveys the fact that there is no information stored here apart from the key being present, whereas with bool you have to rely on a comment, or domain knowledge, to infer that the bools do not actually mean anything. In other words, map[K]struct{} cannot be anything else than set of K, whereas map[K]bool can be: the struct{} version is self-documenting. How is that less readable?