I have resurrected Nevin Pratts Null Pattern implementation.
http://www.squeaksource.com/NullSee examples below.
I also managed to get ifTrue:ifFalse: to work with the null pattern in
squeak.
best regards
Keith
----------
Code like this:
| tmp |
tmp := person office.
tmp notNil ifTrue: [tmp := tmp phone].
tmp notNil ifTrue: [tmp := tmp lastNumberDialed].
tmp notNil ifTrue: [lastNumber := tmp asString].
widget setStringValue: lastNumber.
becomes code like this:
lastNumber := person office phone lastNumberDialed asString.
widget setStringValue: lastNumber.
Code like this:
objectWantingControl
| ctrl |
ctrl := self getController.
ctrl isNil ifTrue: [^nil].
" Trap errors occurring while searching for
the object wanting control. "
^Object errorSignal
handle: [:ex |
Controller badControllerSignal
raiseErrorString:
'Bad controller in objectWantingControl']
do: [ctrl isControlWanted ifTrue: [self] ifFalse: [nil]]
becomes Code like this:
objectWantingControl
self getController isControlWanted ifTrue: [^self].
^nil
Send instant messages to your online friends
http://uk.messenger.yahoo.com