Skip Menu |
Report information
Id: 78278
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: masak <cmasak [at] gmail.com>
Cc:
AdminCc:

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: [BUG] The optional $_ seems to default to $CALLER::_, not $OUTER::_ in Rakudo
Date: Thu, 7 Oct 2010 23:41:16 +0200
To: rakudobug [...] perl.org
From: Carl Mäsak <cmasak [...] gmail.com>
Download (untitled) / with headers
text/plain 961b
<tylercurtis> Actually, maybe { /O/ } should be -> $_? { /O/ } <masak> it is. <masak> rakudo: my $b = { /O/ }; say $b.signature.count; say $b.signature.arity <p6eval> rakudo 377615: OUTPUT«1␤0␤» <jnthn> I'ts more like -> $_ = $OUTER::_ I guess <masak> fair enuf. <tylercurtis> Well, yes, that. <masak> OUTER, and not CALLER? <masak> rakudo: my $b; { $_ = 5; $b = { .say } }; $_ = 42; $b() <p6eval> rakudo 377615: OUTPUT«42␤» <masak> seems to me $_ defaults to $CALLER::_ * masak submits rakudobug <tylercurtis> How does that distinguish between $OUTER::_ and $CALLER::_? The calling scope is the same as the outer scope, no? <masak> no, the outer scope has $_ = 5, but the calling scope has $_ = 42 <jnthn> rakudo: my $b; { my $_ = 5; $b = { .say } }; $_ = 42; $b() <p6eval> rakudo 377615: OUTPUT«5␤» jnthn says that the problem is that there's a binding to the outer container rather than an assignment, and that the last evaluation shows this.
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 311b
new behavior: 12:18 <diakopter> m: my $b; { my $_ = 5; $b = { .say } }; $_ = 42; $b() 12:18 <camelia> rakudo-moar 61d231: OUTPUT«Potential difficulties:␤ Redeclaration of symbol $_␤ at /tmp/7gI9FhwrCH:1␤ ------> my $b; { my $_⏏ = 5; $b = { .say } }; $_ = 42; $b()␤42␤»


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org