[squeak-dev] The Inbox: Collections-nice.869.mcz

Jakob Reschke forums.jakob at resfarm.de
Wed Jan 1 19:18:43 UTC 2020

Hi Nicolas,

Am Mi., 1. Jan. 2020 um 19:48 Uhr schrieb Thiede, Christoph <
Christoph.Thiede at student.hpi.uni-potsdam.de>:

> i := 0.
> ((RunArray new: 4 withAll: 42) collect: [:x | i := i + 1]) asArray. "#(1 1 1 1)""
> This one is broken, isn't it? A RunArray is still a collection of elements
and the comment of collect: in Collection states:

Evaluate aBlock *with each of the receiver's elements* as the argument.
* Collect the resulting values* into a collection like the receiver. Answer

the new collection. [emphasis mine]

IMO the storage optimization of RunArray should not affect the meaning of
its operations. The intermediary RunArray in the code above should also
contain 1, 2, 3, 4, even though it defeats the optimization.

Introduce a new selector for the optimized collect operation?

Kind regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200101/042cc0dc/attachment.html>

More information about the Squeak-dev mailing list