Nicolai,
Am 16.03.15 um 11:59 schrieb Nicolai Hess:
so how would you name the current #do: if you had the choice?
I still think this looks very logical:
#do:
#do:separatedBy:
#doWithIndex:
#doWithSomeOtherSpecialty:andEvenMoreStuff:
And then there still ist the question if the order of the arguments
should be changed:
today:
do: [:each| ]
doWithIndex: [:each :index| ]
future:
do: [:each| ]
withIndexDo: [:idx :each | ]
Do you really think that is better?
I think that if we move the withIndex part to the beginning of the
message, it overstates the importance of the fact that we also need
the index inside the iteration block.
This would make sense if it was a Collection with an Index. If there
was an IndexedCollection class and maybe some message like
asIndexedCollection or withIndex, which turns any collection into an
IndexedCollection. Then the message might be a shortcut for "make
thsi an indexed collection and iterate over it using its index" -
comparable to Dictionary>>#keysAndValuesDo: - but please be
aware that a Dictionary has keys and values by its very own nature.
A Collection doesn't have an index (other than the fact that the
elements are stored in some non-guarantueed order).
This may all sound quite picky, but I think this is plain wrong and
you are about to introduce not only incompatible, but also
misleading naming for methods that exist on all Smalltalk dialects.
Joachim
--
-----------------------------------------------------------------------
Objektfabrik Joachim Tuchel mailto:jtuchel@objektfabrik.de
Fliederweg 1�� �� �� �� �� �� �� �� �� �� �� �� ��http://www.objektfabrik.de
D-71640 Ludwigsburg http://joachimtuchel.wordpress.com
Telefon: +49 7141 56 10 86 0�� �� �� �� ��Fax: +49 7141 56 10 86 1