David Green writes:
> 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".
Well, C<for $foo> gives you a one-iteration loop. But perhaps list
flatten could work on iterators:
for *$foo { ... }
Which presumably is the same thing as:
for @$foo { ... }
Which implies that iterators can behave as arrays. Then you get to
weird questions like what:
$foo[-1]
Does. Iterate to the end and return that? The array abstraction
doesn't work well for iterators, so perhaps that's not the best way to
go.
I'm personally a fan of "every" as well as renaming Ruby's "each" to
something else.
Luke