On Sun, 10 Jul 2016 16:19:34 -0700, c...@zoffix.com wrote: > 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..2ok 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.