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

Owner: Nobody
Requestors: lloyd.fourn [at] gmail.com
Cc:
AdminCc:

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



Subject: self referential variable declaration not picked up
Date: Mon, 15 Feb 2016 03:26:15 +0000
From: Lloyd Fournier <lloyd.fourn [...] gmail.com>
To: "rakudobug [...] perl.org" <rakudobug [...] perl.org>
Download (untitled) / with headers
text/plain 486b

my @data = 1,{},@data,"YEWHAT??"; 
say @data.perl;

# (\Array_140251854808256 = [1  Array_140251854808256 YEWHAT??])

It's putting the {} before it that makes the check stop working

p 'my @data = 1,@data,"YEWHAT??";say @data'
===SORRY!=== Error while compiling -e
Cannot use variable @data in declaration to initialize itself
at -e:1

I had a ',' where a ';' should have been and it slurped up the next line where I used @data, and put it into itself. Took me forever to figure it out!


Download (untitled) / with headers
text/plain 379b
Still present in today's rakudo de5d9e: <Zoffix> m: my @data = @data; <camelia> rakudo-moar de5d9e: OUTPUT«===SORRY!=== Error while compiling <tmp>␤Cannot use variable @data in declaration to initialize itself␤at <tmp>:1␤------> my @data = @⏏data;␤ expecting any of:␤ term␤» <Zoffix> m: my @data = {}, @data; <camelia> rakudo-moar de5d9e: ( no output )


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