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

Owner: Nobody
Requestors: bahtiar [at] gadimov.de
Cc:
AdminCc:

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



Date: Thu, 03 Mar 2016 23:31:50 +0100
From: Bahtiar `kalkin-` Gadimov <bahtiar [...] gadimov.de>
To: rakudobug <rakudobug [...] perl.org>
Subject: Could not find symbol '&EXPORT'
Download (untitled) / with headers
text/plain 711b
Hi, trying to access the EXPORT in a module fails when done like this: ```perl6 use v6; use Test; module Foo::Bar { sub first is export {}; sub second is export {}; } plan 2; is Foo::Bar::EXPORT::ALL::.elems, 2; my \module = Foo::Bar; is Foo::Bar::.keys, module::.keys; diag module::EXPORT::.keys; # fails with Could not find symbol '&EXPORT'} ``` while talking about this in #perl6 @perlpilot noticed the following: https://gist.github.com/perlpilot/018013c0766796b92893 and suggested this might be a bug. So is this a bug, or did I misunderstood the syntax? ``` $ perl6 -v This is Rakudo version 2015.12-242-g8bd7ee6 built on MoarVM version 2016.01 implementing Perl 6.c. ``` Thanks kalkin-
Download (untitled) / with headers
text/plain 700b
Not sure if it's a bug, but it's still present in Rakudo version 2016.06-154-g55c359e built on MoarVM version 2016.06-9-g8fc21d5 I tried using $module instead of module and this was the result: zoffix@VirtualBox:/tmp/tmp.yz8WXXEuu2$ cat x.p6 use v6; use Test; module Foo::Bar { sub first is export {}; sub second is export {}; } plan 2; is Foo::Bar::EXPORT::ALL::.elems, 2; my $module = Foo::Bar; is Foo::Bar::.keys, $module::.keys; diag $module::EXPORT::.keys; zoffix@VirtualBox:/tmp/tmp.yz8WXXEuu2$ perl6 x.p6 1..2 ok 1 - not ok 2 - # Failed test at x.p6 line 15 # expected: '' # got: 'EXPORT' # Looks like you failed 1 test of 2 zoffix@VirtualBox:/tmp/tmp.yz8WXXEuu2$
Download (untitled) / with headers
text/plain 1.9k
On Sun, 10 Jul 2016 16:19:34 -0700, cpan@zoffix.com wrote: Show quoted text
> Not sure if it's a bug, but it's still present in Rakudo version > 2016.06-154-g55c359e built on MoarVM version 2016.06-9-g8fc21d5 > > I tried using $module instead of module and this was the result: > > zoffix@VirtualBox:/tmp/tmp.yz8WXXEuu2$ cat x.p6 > use v6; > use Test; > module Foo::Bar { > sub first is export {}; > sub second is export {}; > } > > plan 2; > > is Foo::Bar::EXPORT::ALL::.elems, 2; > > my $module = Foo::Bar; > > is Foo::Bar::.keys, $module::.keys; > > diag $module::EXPORT::.keys; > zoffix@VirtualBox:/tmp/tmp.yz8WXXEuu2$ perl6 x.p6 > 1..2 > ok 1 - > not ok 2 - > > # Failed test at x.p6 line 15 > # expected: '' > # got: 'EXPORT' > > # Looks like you failed 1 test of 2 > zoffix@VirtualBox:/tmp/tmp.yz8WXXEuu2$
Is $module:: valid syntax for that? Would that not try to look up a scalar variable in a module called 'module'? As for the original, it seems the tests succeed (at least on current rakudo) and the diag complains about EXPORT: (01:11:53 AM) skids: m: use v6; use Test; module Foo::Bar { sub first is export {}; sub second is export {}; }; plan 2; is Foo::Bar::EXPORT::ALL::.elems, 2; my \module = Foo::Bar; is Foo::Bar::.keys, module::.keys; diag module::EXPORT::.keys; say Foo::Bar::EXPORT::ALL::.keys; say Foo::Bar::.keys; say module::.keys; (01:11:54 AM) camelia: rakudo-moar 1aee9a: OUTPUT: «1..2␤ok 1 - ␤ok 2 - ␤Could not find symbol '&EXPORT'␤ in block <unit> at <tmp> line 1␤␤» ...and it quite possibly should. I don't think that constant definitions are so macroish that they get resolved as name parts: $ perl6 -e 'use v6; module Foo { our constant Bar = 42 }; Foo::Bar.say; my \module = Foo; module::<Bar>.say; module::Bar.say' 42 42 Could not find symbol '&Bar' in block <unit> at -e line 1 ...the postfix :: may be a special case, but I can't seem to find where that might be specced. Perhaps safest to stick to .WHO.


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