[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how expressive are they?




On Fri, 22 Nov 2002, Guy Steele - Sun Microsystems Labs wrote:

>    x and: [y] and: [z]
>    x ifTrue: [y] ifFalse: [z]
>
> And see how much wordier these are than (AND x y z) and (IF x y z).

n-ary AND is very nice.  But just as you liked the subtleties of
and/if/when, I like the wordiness of ifTrue:ifFalse:,
because it allows for so much variation:

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]