[ENH] ifEmptyParam-md

Avi Bryant avi at beta4.com
Fri Jan 30 20:18:44 UTC 2004

On Jan 30, 2004, at 12:03 PM, Adam Spitz wrote:

> I thought it was a kluge too, at first (I started playing with it
> purely for pragmatic reasons - I didn't feel like writing #ifEmpty:
> and #ifNotEmptyDo: and #ifZero: and #ifNotZeroDo: and so on), but
> it's starting to grow on me. Now it kinda feels right to put this
> on Object - it's a way of telling an object, "I probably want you,
> except sometimes when I want this other thing."

I agree that that's a useful concept, but I think calling it 
#if:then:else: is probably not a good idea.  The terms are too closely 
associated with basic control flow to be given this more complex 

Remember that you can also always use #in:, eg:

^ foo bar baz in: [:x | x isEmpty ifTrue: [...] ifFalse: [...]]

(Though incidentally why there's an #isKindOf: check at the beginning 
of #in: I have no idea... )

More information about the Squeak-dev mailing list