On Sun Jan 17 22:29:57 2016, gfldex wrote:
> # https://gist.github.com/b0d44595e0d3b314a09d
> 
> # Module.pm6
> unit module Module;
> 
> sub EXPORT ($var) {
>         { foo => sub () {} }
> }
> 
> # use-module.p6
> 
> use v6;
> use lib '.';
> use Module 42;
> 
> # OUTPUT:
> # Error while importing from 'Module':
> # no EXPORT sub, but you provided positional argument in the 'use'
> statement
> # at /home/dex/projekte/perl6/rakudobug/EXPORT+unit-package/use-
> module.p6:3
> # ------> use Module 42⏏;
> 
> # Package.pm6
> 
> unit package Package;
> 
> sub EXPORT ($var) {
>         { foo => sub () {} }
> }
> 
> # use-package.p6
> 
> use v6;
> use lib '.';
> use Package 42;
> 
> # OUTPUT:
> # Error while importing from 'Package':
> # no EXPORT sub, but you provided positional argument in the 'use'
> statement
> # at /home/dex/projekte/perl6/rakudobug/EXPORT+unit-package/use-
> package.p6:3
> # ------> use Package 42⏏;
> 
> # expected: either complain about unit and EXPORT in the same file or
> # make it work

&EXPORT must be in the outermost lexical scope of the compilation unit. 
Which...uh...it appears it should be here! I suspect the compiler is sneaking a 
secret extra scope in as a result of the unit declaration. Can we fix that? Yes 
for module/class/grammar. But for roles, not really as they're generic and the 
parameter has to go somewhere. But that makes a weird discontinuity. Hmmm. :-)

Reply via email to