Skip Menu |
Report information
Id: 128854
Status: new
Priority: 0/
Queue: perl6

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

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



Date: Fri, 5 Aug 2016 19:05:47 +0200
From: mt1957 <mt1957 [...] gmail.com>
To: rakudobug [...] perl.org
Subject: outer declaration of package/module/class disturbs namespace
Download (untitled) / with headers
text/plain 1024b
Hi, Got the following error Type 'M0::C1' is not declared at /home/marcel/Languages/Perl6/Tests/Class/moc1.pl6:8 ------> has M0::C1⏏ $!c1; Malformed has at /home/marcel/Languages/Perl6/Tests/Class/moc1.pl6:8 ------> has M0::⏏C1 $!c1; from the following code; The program m0c1.pl6 #!/usr/bin/env perl6 use v6.c; use M0::C1; class xyz { # same for package and module class M0 { has M0::C1 $!c1; } } my $c1 = xyz::M0.new; and the file M0/C1.pm6 use v6.c; class M0::C1 {} Error disappears when outer class(xyz) is removed and 'my $c1 = xyz::M0.new;' is changed into 'my $c1 = M0.new;' As an alternative the error also disappears when renaming the inner class into Mx0 and change 'my $c1 = xyz::M0.new;' into 'my $c1 = xyz::Mx0.new;'. And this one helps too and is maybe the recommended way to do; rewrite 'has M0::C1 $!c1;' into 'has ::M0::C1 $!c1;'. So 1) the message is not helpful and 2) it doesn't show a consequent behavior if I look at the last two workarounds. Greetings, Marcel


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