On Jan 4, 2008 9:18 AM, Jonathan Lang <[EMAIL PROTECTED]> wrote:
> Joe Gottman wrote:
> > On the other hand, this being Perl, I do believe it should be easy to
> > specify the concurrent case. I think that a <forall> keyword (and a
> > <givenall> keyword corresponding to <given>) would be a good idea.
> > These would not be quite parallel to <for> and <given> because there
> > would be some subtle differences arising from the concurrent
> > processing. For instance, <forall> probably should not be used with
> > <last>, because <last> should stop subsequent iterations and the
> > subsequent iterations could already have occurred when it is called.
> > Similarly, <givenall> should not be used with <continue>, because the
> > next case might already have been checked when <continue> is called.
>
> I don't think that there's need for a 'forall' keyword. Note that
> Perl 6 has both Lists and Bags, the difference being that a List is
> ordered while a Bag isn't. So what happens when you feed a Bag into a
> "for" statement? Conceptually, you'd expect to get evaluation across
> its members with no promises concerning the order of evaluation.
forall was about concurrency, not order of evaluation. There is a difference
between running in an arbitrary order serially and running in parallel.
for %bag {
.say;
}
If the bag had elements "hello", "world", I think printing:
helworld
lo
Would definitely count as violating the principle of least surprise.
Luke