develooper Front page | perl.perl6.compiler | Postings from February 2012

[perl #111284] [BUG] Values aren't shared between two 'our' declarations of a variable in Rakudo

From:
Carl Mäsak
Date:
February 22, 2012 02:42
Subject:
[perl #111284] [BUG] Values aren't shared between two 'our' declarations of a variable in Rakudo
Message ID:
rt-3.6.HEAD-4610-1329907328-1328.111284-82-0@perl.org
# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #111284]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=111284 >


<pmurias> moritz: our both declares a package variable and creates an
lexical alias to it
<moritz> right
<masak> nom: { our $a = 42 }; say $a
<p6eval> nom 4130f6: OUTPUT«===SORRY!===␤Variable $a is not
declared␤at /tmp/_0FYRayuIK:1␤»
<masak> perhaps the easiest way to demonstrate that.
<moritz> under 'no strict', that would print 42
<masak> nom: { our $a = 42 }; say our $a
<p6eval> nom 4130f6: OUTPUT«Any()␤»
<masak> huh!
<pmurias> nom: {our $a = 42};our $a; say $a;
<p6eval> nom 4130f6: OUTPUT«Any()␤»
<masak> I call bug.
<pmurias> me too
* masak submits rakudobug
<masak> b: { our $a = 42 }; say our $a
<p6eval> b 1b7dd1: OUTPUT«42␤»
<masak> niecza: { our $a = 42 }; say our $a
<p6eval> niecza v14-57-gd05a5fe: OUTPUT«42␤»
<moritz> I could have sworn that one worked in nom

Rakudo prints 'Any()' -- I expect it to print '42' there, just like b
and niecza.



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About