[ANSI-Smalltalk] A list of interesting methods, ifNotNil:
cstb
jas at cruzio.com
Tue Mar 25 03:12:32 GMT 2008
At 01:08 AM 3/20/2008, you wrote:
>John Dougan wrote:
>>Ralph Johnson wrote:
>>>>Object>>ifNil:
>>>> Object>>ifNil:ifNotNil:
>>>> Object>>ifNotNil:
>>>> Object>>ifNotNil:ifNil:
>>>
>>There actually is a minor controversy here as the VisualWorks version of these has the block for the ifNotNil: clauses take an optional argument.
I have long preferred
isNil,
notNil,
and nonNil
so I'd rather have
isNil: a0block
notNil: a0block
nonNil: a1block
and some combinations, e.g.
isNil: is0block notNil: not0block
isNil: is0block nonNil: non1block
...
I don't expect to hear much agreeement,
just tossing it in for consideration.
The pattern generalizes to also cover
null, empty, blank, and value,
number, numeric, and integer,
zero, one, and infinity,
boolean, character, string, and symbol,
singular, element and collection.
All of which seem highly generic,
and reasonably useful, to me.
The optional arg thing is ok, and
could be extended to all the above forms,
but isn't as intention-revealing.
-Jim
More information about the ANSI-Smalltalk
mailing list