About "contains:"
Bob Nemec
bobn at home.com
Sun Nov 21 21:49:35 UTC 1999
On Sun, 21 Nov 1999 12:42:02 -0800, Andrew P. Black wrote:
....
>Collection | contains: aBlock
>Set | contains: anObject
>contains: aNumber
#contains: is also used by Rectangle to test aPoint.
There was a thread on comp.lang.smalltalk on this a while back... raised many of the same points you do.
In general, #contains: is too much of a synonym for #includes:
#contains: does not imply a block as the argument, like #detect:
VA implements #conform: which works, but is a bit awkward.
I'd really like to find a better work that implies #hasElementSuchThat: but uses a better method name.
Seems like there is no clear winner so far.
I see variations of #detect:ifAbsent: used instead. like...
^(aCollection detect: [:each | each aMethod] ifAbsent: [nil]) notNil
Bob Nemec
bobn at home.com
More information about the Squeak-dev
mailing list
|