On Sun, 13 Oct 2002, fearcadi wrote: : in : http://archive.develooper.com/perl6-language%40perl.org/msg11440.html : Larry Wall wrote: : >I'm wondering whether the single ones could indicate parallel streams. : >We had the difficulty of specifying whether the C<for> loop should : >terminate on the shorter or the longer stream. We could say that | : >terminates on the longer, and & on the shorter. Possibly there's : >some relationship with any() and all() in there as well. The | could : >generally be construed as a comma that doesn't guarantee ordering. : >So cases could be written : : but then in the "for" loop @a | @b should result in *ordered* : any(@a,@b) because we need to distinguish the first and second stream when : attaching to the arguments of -> ... closure. : : While inside when @a|@b results in unordered any(...). : How this lives together?
The | or & doesn't really indicate a superposition in the C<for>. All I meant by "unordered" was that it was not guaranteed that @a is evaluated before @b, so they could in theory be evaluated in separate subthreads. The C<for> loop would just be "stealing" the |/& notation because it's convenient to be able to distinguish whether both values have to be there or only one for the loop to continue. The streams would stay discrete, however. And the $a | $b in the declaration would likewise not be producing an any(). It's just a funny kind of anchor to pattern match the formal args against the actual args. But we haven't thought through all the ramifications yet, so it may yet turn out to be a bad idea. Larry