4 ms·
It's poor name. If it has no members, it holds no bits. Therefore it has no state. It's not enough for an object to exist in order to hold state. It must be cap
by kazinator 2y ago
It's poor name. If it has no members, it holds no bits. Therefore it has no state. It's not enough for an object to exist in order to hold state. It must be capable of distinguishing at least between two values, like true or false. If something doesn't hold state, the word state has no business in its name.
This thing is just a counterpart to void that is a class. A better name would be voidclass or something along those lines.
(There is a Monostate pattern, but that involves a class with state: just all the state is static. It's basically like a module with global variables. Completely different thing.)
- binary132 2y ago“True” and “False” sound like two states. This is just one. :)
- kazinator 2y agoYes, exactly like 640K sounds like a power of two, if you're a MS-DOS user. But in a way, this is right since: <no of bits> 2 = <no of states> When the number of bits is 0, 2^0 = 1: 1 state. A state machine with one state is certainly possible. Problem is we need 2 or more states to do anything useful with state. We can draw an initial state bubble in a state diagram and not add any states; it can even have transitions back to itself. So maybe monostate is not exactly a misnomer; it's just weird to mention state about something that is not useful for working with state.