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

Owner: Nobody
Requestors: bri [at] abrij.org
Cc:
AdminCc:

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



Subject: Cannot import a symbol from precomp if its namespace is occupied
Download (untitled) / with headers
text/plain 1.2k
If a module explicitly uses a symbol as a namespace, it cannot export a class or role as that symbol name. $ cat > /tmp/f1.pm6 module f1 { class A::B { } class A is export { } } $ PERL6LIB=/tmp perl6 -e "use f1" ===SORRY!=== Error while compiling -e Cannot import symbol A from f1, because it already exists in this lexical scope at -e:1 ------> use f1⏏<EOL> $ cat > /tmp/f1.pm6 module f1 { my $A::B; class A is export { } } $ PERL6LIB=/tmp perl6 -e "use f1" ===SORRY!=== Error while compiling -e Cannot import symbol A from f1, because it already exists in this lexical scope at -e:1 ------> use f1⏏<EOL> This appears to be due to the namespace symbol being imported even though nothing in it exports... $ cat /tmp/f1.pm6 module f1 { my $A::B = 42 } $ PERL6LIB=/tmp perl6 -e "use f1; say ::(A)" Use of uninitialized value of type A in string context. Methods .^name, .perl, .gist, or .say can be used to stringify it to something meaningful. in block <unit> at -e line 1 No such symbol '' in block <unit> at -e line 1 Actually thrown at: in block <unit> at -e line 1 $ PERL6LIB=/tmp perl6 -e "say ::(A)" ===SORRY!=== Error while compiling -e Undeclared name: A used at line 1 (I think this is a newish behavior but couldn't figure out how to get bisectable to handle a precomp)


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