[ANSI-Smalltalk] List of interesting methods, Collection only

Paolo Bonzini bonzini at gnu.org
Thu Mar 20 07:28:02 GMT 2008


> Collection>>noneSatisfy: (renamed to noneSatisfies:?)

Yes.  Squeak has this name, but bad grammar shouldn't go in a standard
probably...

> Collection>>empty (isn't this removeAll?)

It's named so that "x copyEmpty = x copy empty".

> Collection>>gather: (what's this?)

It's in Squeak and Seaside uses it; it's

    gather: aBlock
       ^self inject: self copyEmpty into: [ :result :each |
           result addAll: (aBlock value: each); yourself ]

> Collection>>removeAll: (what is the argument?)

This is already in the standard (page 176), but it says that "The
behavior is undefined if any element of [the argument] is not found".
I propose changing this to raise an error and...

> Collection>>removeAll:ifAbsent:

... provide this version which passes the bad element to the block in 
the second argument.  Both are in David N. Smith's "Black Book".

Paolo



More information about the ANSI-Smalltalk mailing list