Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upVoid repeat propagates the calling context to its lhs #14174
Comments
This comment has been minimized.
This comment has been minimized.
From @cpansproutIf x with parentheses around the lhs occurs in void context, no matter where it occurs in a sub it will propagate the context in which the sub was called: $ ./perl -lIlib -e 'sub c { print qw[void scalar list][wantarray + defined wantarray] } sub f { (c())x(c()); print "---"; } f(); $_=f(); () = f() ' scalar list That’s *weird*. But what should it do? Internally, x falls back to scalar repeat when not in list context. (It doesn’t check explicitly for scalar context.) So scalar context here would make sense. (I suspect some instances of the void context result in stack bugs.) -- Father Chrysostomos |
This comment has been minimized.
This comment has been minimized.
From @cpansproutOn Mon Oct 20 20:21:28 2014, sprout wrote:
I was right about the stack bug, which I fixed a while ago in 3a100da. I have just fixed this bug for the most part in commit 1e2dd51, by applying scalar context to the lhs if the repetition is known to be in void context at compile time. At the end of a subroutine it still exhibits the buggy behaviour. -- Father Chrysostomos |
This comment has been minimized.
This comment has been minimized.
The RT System itself - Status changed from 'new' to 'open' |
Migrated from rt.perl.org#123020 (status was 'open')
Searchable as RT123020$