On 13 Mar 2015, at 21:44, stepharo <stepharo@free.fr> wrote:
Le 10/3/15 14:40, Joachim Tuchel a écrit :
Marcus
So sorry for this false accusation. It is proprietary in Squeak. And even if it was Dan's idea to rename it, I'd like to learn more about the reasoning. My understanding would be:
#do: iterates over a collection #doWithIndex: iterates over a collection and also keeps track of the current index.
Sounds very consistent to me. the most important thing I want the machine to do is iterate over the collection, and the index thing is just a variant thereof.
#do: iterates over a collection #withIndexDo: keeps track of the index while iterating over a collection
Sounds clumsy to me. Introduces incompatibilities for not much value. If people complained about #do: as not intentioon revealing and opted to rename it to something like #withEachDo: , then I c +1
I think the reason was that there are withIndexCollect: , reverseWithIndexDo:, And of course the real thing we learn: if you do something, do it for real and finish. Now we have the problem: which version do we pick? We should pick one, rename the callers and deprecate the other. In Pharo5. (#gather: is already on my list for that, too). Marcus