[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: how expressive are they?
> x ifTrue: [y]
> x ifFalse: [y]
> x ifTrue: [y] ifFalse: [z]
> x ifFalse: [y] ifTrue: [z]
> x ifNil: [y]
> x ifNotNil: [y]
> x ifNil: [y] ifNotNil: [z]
> x ifNotNil: [y] ifNil: [z]
> x ifEmpty: [y]
> x ifNotEmpty: [y]
> x ifEmpty: [y] ifNotEmpty: [z]
> x ifNotEmpty: [y] ifEmpty: [z]
> x ifEmptyOrNil: [y]
> (x y z) ifNotNilDo: [:result | q]
BTW, I detect a certain lack of separation of concerns in the above. From a
design perspective, wouldn't it be better to separate the 'if' out from all
of those messages, so as to be able to more flexibly combine 'if' with
things that don't already have 'if' in them, and similarly in order to be
able to use the predicates independently of the 'if' form? Seems like it
would be the object-oriented thing to do...
What would such a construct look like like, in Smalltalk? Might it show up
syntactical weaknesses in creating such constructs without macros?