[squeak-dev] Re: Dictionary>>collect: returning OrderedCollection?
andreas.raab at gmx.de
Fri Jun 13 07:29:33 UTC 2008
Thanks everyone. I filed a bug and a fix at
BTW, Josh pointed out that ANSI agrees with that definition too:
184.108.40.206 Message Refinement: collect: transformer
Answer a new collection constructed by gathering the results of
evaluating transformer with each element of the receiver.
For each element of the receiver, transformer is evaluated with the
element as the parameter. The results of these evaluations are collected
into a new collection. The elements are traversed in the order specified
by the #do: message for the receiver. Unless specifically refined, this
message is defined to answer an object conforming to the same protocol
as the receiver.
Answer a new instance of the receiver's type with the same keys. For
each key of the answer, a new element is obtained by evaluating
transformer with the corresponding element of the receiver as the parameter.
Hans-Martin Mosner wrote:
> Andreas Raab schrieb:
>> Does anyone besides me consider this a bug? What does ANSI say about
>> this issue?
> I think that #collect: should be in line with #select: and #reject:
> which both return Dictionaries.
> One possible reason why #collect returns a different kind of collection
> is that for some base collections, the results of the block might not
> fit (for example, "aByteArray collect: [:x | x odd]" would raise an
> Incidentally, VisualWorks behaves as you and I expect.
More information about the Squeak-dev