State of ifEmpty:ifNotEmpty:, ifNil:ifNotNil: and related messages across Smalltalks?

pharo, smalltalk, squeak

Solution

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.

Problem

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.

Original source