On 8/19/04, [EMAIL PROTECTED] (David Green) wrote:
> >On Aug 14, 2004, at 5:52 PM, Larry Wall wrote:
>
> >>    for all $*IN  # all() is junction
> >>    for each $*IN # each method wants closure if we follow Ruby
> >>    for next $*IN # next $foo is a loop exit
[...]
>"Each" and "every" are the obvious choices, but I wouldn't want to 
>follow Ruby exactly: "each" has a definite connotation of 
>"separately", "one at a time" that works in "for each $foo"; "every" 
>works better for the overall method.

Hang on -- should we be saying "for each $foo" or "for $foo.each" 
anyway?  We don't say "for @foo.each"; the iteration is implicit.  So 
I'm thinking it should be "for $foo" or "while next $foo".

(If we could call it "next", which is even more desirable now, seeing as 
the main place where "each" made sense was "for each", where it should 
be implicit anyway -- "while each $foo" doesn't sound as good, though I 
guess it's passable; "print each $foo" sounds like it's looping even 
though it isn't.  "print following $foo"?  "print subsequent $foo"?  The 
latter could be abbreviated to $foo.seq ....)

Hm, we don't need a fixed name to be able to use the iterator 
implicitly, though.  Why not

     method another is iterator { ... }

using a trait to identify the iterating method(s?).  That neatly passes 
the buck of what to call it to the individual programmer instead.  =)


                  - David "not sure whether the idea of overloading ++ as
                    an iterator can be mentioned in polite company" Green

Reply via email to