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

ould understand it. The variant could be #withEachDoIndexed:
But not that one ;-)
... but this is completely off-topic of course...
Joachim
Marcus Denker <marcus.den...@inria.fr> hat am 10. März 2015 um 14:32 geschrieben:


On 10 Mar 2015, at 14:25, Joachim Tuchel < jtuc...@objektfabrik.de <mailto:jtuc...@objektfabrik.de>> wrote:

Sounds like a bad naming to me. I don't see why withIndexDo is any better. It even contradicts the order of the arguments. And it is Proprietary to Pharo.
No, if you look a the timeStamp it was done in 1997 by Dan.

Joachim


Am 10.03.2015 um 13:39 schrieb Sanjay Minni < s...@planage.com <mailto:s...@planage.com>>:

Yes usually I have to open the code and see, use intuition or write a sample code to find out incidentally here I also have to figure out which is the current and which is the deprecated version ... well thats it
sanjay

---
Sanjay Minni
+91-9900-902902
http://in.linkedin.com/in/sanjayminni

On Tue, Mar 10, 2015 at 5:57 PM, Thierry Goubier [via Smalltalk] <[hidden email]> wrote:

    And one has to guess that elementAndIndexBlock means
    [:each :i | ... ] ? (and of course not [:i :each | ... ] )
    I'm allways looking for senders with that type of code ;)
    arguments to blocks are usually not documented.
    Thierry

    2015-03-10 13:27 GMT+01:00 Peter Uhnák <[hidden email]
    <http:/user/SendEmail.jtp?type=node&node=4810931&i=0>>:

        On Tue, Mar 10, 2015 at 1:23 PM, Joachim Tuchel <[hidden
        email]
        <http:/user/SendEmail.jtp?type=node&node=4810931&i=1>> wrote:

#doWithIndex: ?
        doWithIndex: elementAndIndexBlock
        "Use the new version with consistent naming"
        ^ self withIndexDo: elementAndIndexBlock



    ------------------------------------------------------------------------
    If you reply to this email, your message will be added to the
    discussion below:
    
http://forum.world.st/when-iterating-over-a-collection-how-to-determine-the-current-objects-index-tp4810920p4810931.html

    To unsubscribe from when iterating over a collection how to
    determine the current objects index, click here.
    NAML
    
<http://forum.world.st/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>


---
Regards, Sanjay

------------------------------------------------------------------------
View this message in context: Re: when iterating over a collection how to determine the current objects index <http://forum.world.st/when-iterating-over-a-collection-how-to-determine-the-current-objects-index-tp4810920p4810945.html> Sent from the Pharo Smalltalk Users mailing list archive <http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html> at Nabble.com <http://nabble.com/>.


Reply via email to