[ANSI-Smalltalk] Behaviour of #collect:

Richard O'Keefe ok at cs.otago.ac.nz
Wed Sep 24 02:44:17 BST 2008


On 23 Sep 2008, at 5:10 am, Paolo Bonzini wrote:
> I don't like very much having non-block methods before the last  
> argument...
>
Me neither.  'from:' is also not very intention-revealing.  In ANSI  
Smalltalk
it generally precedes the starting index of a subsequence.  As it  
happens, I
also have
	aCollectionClass withAll: aSequence from: start to: finish
which is like
	aCollectionClass withAll: (aSequence copyFrom: start to: finish)
except that it doesn't do the intermediate copy (which is why 'copy' is
missing from the selector).

> I preferred Richard's selector, which I guess is based on the idea  
> that
> it is like
>
>      Array withAll: ('abc' collect: [:each | each codePoint])
>
> except that it works. :-)

Exactly so.




More information about the ANSI-Smalltalk mailing list