You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would be fine with having it be lexical rather than dynamic as in Perl 6. Lexical seems to rhyme better with what we can reasonably do with macros, and the dynamic part was never a dealbreaker anyway.
my values = gather {
take 1;
for [2, 3, 4] -> v {
take v;
}
}
Would desugar to something like
my _tmp_array;
_tmp_array.push(1);
for [2, 3, 4] -> v {
_tmp_array.push(v);
}
my values = _tmp_array;
I also don't mind if the gather construct is not lazy, since we don't really have lazy lists/arrays in 007. The important thing is that everything works out nicely with a take finding its appropriate surrounding gather.
Note that there are bound to be some cases where a take is lexically inside the gather, but the `gather has completed already;
sub foo() {
gather {
take 1;
return sub() { take 2 };
}
}
foo()(); # ERROR: the `take 2` tried to take against a `gather` that has already finished
The text was updated successfully, but these errors were encountered:
I would be fine with having it be lexical rather than dynamic as in Perl 6. Lexical seems to rhyme better with what we can reasonably do with macros, and the dynamic part was never a dealbreaker anyway.
Would desugar to something like
I also don't mind if the
gather
construct is not lazy, since we don't really have lazy lists/arrays in 007. The important thing is that everything works out nicely with atake
finding its appropriate surroundinggather
.Note that there are bound to be some cases where a
take
is lexically inside thegather
, but the `gather has completed already;The text was updated successfully, but these errors were encountered: