2 ms·
> That's just wrong. Boolean is the type. False is just one possibile value of that type. Having false and true be singleton types is perfectly cromulent. Tha
by masklinn 5y ago
> That's just wrong. Boolean is the type. False is just one possibile value of that type.
Having false and true be singleton types is perfectly cromulent.
That's how Smalltalk has been doing it for 40 years, and why it can do without control structures:
Boolean subclass: False [
ifTrue: trueBlock ifFalse: falseBlock [
^falseBlock value
]
"..."
Boolean subclass: True [
ifTrue: trueBlock ifFalse: falseBlock [
^trueBlock value
]
"..."