3 ms·
I'm not sure what you're trying to say? Bool can have 2 states, but in software we need things that have 3, 4 or N states too. So we need an abstraction that is
by gnulinux 6y ago
I'm not sure what you're trying to say? Bool can have 2 states, but in software we need things that have 3, 4 or N states too. So we need an abstraction that is like Bool but can have any number of cases. Moreover, bool is clearly not sufficient as it not only has 2 states, it can only represent exactly 1 bit of information. Whereas, e.g. in Haskell "Maybe X" has 2 states either "just X" or "nothing" but can represent arbitrary amount of information. (imagine having Go compiler forcing (bool, X) pair to have only two states either "(true, X)" or "(false, null)" such that compiler doesn't allow you to construct e.g. "(false, X)"). So bool is like very very specific example of what is being discussed here.