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.
Likewise, I wonder if there might be a more general way to handle the
'givenall' concept. Say, by marking a block as being concurrent
(i.e., parallel) in nature rather than sequential (i.e., series).
That is, you normally evaluate a block's statements in order from the
first to the last; marking the block as concurrent would tell the
parser that the order of evaluation within this block isn't important.
If a block of "when" statements is parallelized in this manner, you
get the effect of the proposed 'givenall' keyword without the inherent
restrictions that requiring the keyword would impose.
Jonathan "Dataweaver" Lang