Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not find symbol '&EXPORT' #5160

Open
p6rt opened this issue Mar 3, 2016 · 4 comments
Open

Could not find symbol '&EXPORT' #5160

p6rt opened this issue Mar 3, 2016 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Mar 3, 2016

Migrated from rt.perl.org#127653 (status was 'open')

Searchable as RT127653$

@p6rt
Copy link
Author

p6rt commented Mar 3, 2016

From bahtiar@gadimov.de

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-

@p6rt
Copy link
Author

p6rt commented Jul 10, 2016

From @zoffixznet

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$

@p6rt
Copy link
Author

p6rt commented Aug 21, 2017

From @skids

On Sun, 10 Jul 2016 16​:19​:34 -0700, cpan@​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..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.

@p6rt
Copy link
Author

p6rt commented Aug 21, 2017

The RT System itself - Status changed from 'new' to 'open'

@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant