2 ms·
I've absolutely had a real life door in the locked-open state, that is done to prevent it from closing. As some doors always need a key to open from the outside
by ben_w 2y ago
I've absolutely had a real life door in the locked-open state, that is done to prevent it from closing. As some doors always need a key to open from the outside, this is useful. And as they can be further locked to need a key even from inside, that's not making "closed-locked" redundant instead.
For the general case, I think this may have been the inspiration for swift having enums with associated values, which in the author's toy example would have been
enum DoorState {
case open
case closed(Bool)
}