What is the current state of messages like ifEmpty:ifNotEmpty:, ifEmpty:, ifNotEmpty: ifNil:ifNotNil:, ifNil: and ifNotNil:?
Are they available across Smalltalks, and do they behave consistently? You still see things like "object isEmpty ifTrue: [...] ifFalse: [...]" in older code.
Currently, I think the state of the art is covered very well by the Seaside coding convetions:
Portability
[…]
Do not use any of these methods, they are missing, broken or have different semantics on some platforms:
[…]
- Object:
#ifNotNil:,#ifNotNilDo:,#in:, ...- Boolean:
#and:and:and:,#or:or:or:, ...- Collection:
#=,#pairsDo:,#with:collect:- String:
#match:- Stream:
#position,#position:,#isEmpty[…]
(highlighting by yours truly)
Since Seaside has been ported to Pharo, Squeak, GemStone, Dolphin, VisualWorks, VA Smalltalk, GNU Smalltalk, I think this list has some authority.
Also note that even #isEmpty seems to be not portable, for Streams at least.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With