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

Colonpairs with indirect-lookup as variables fail to compile right #1532

Open
zoffixznet opened this Issue Feb 16, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@zoffixznet
Contributor

zoffixznet commented Feb 16, 2018

Spotted here: https://stackoverflow.com/questions/44212696/why-doesnt-perl-6s-colon-pair-and-name-interpolation-work-together

Expected these two versions to be equivalent:

$ ./perl6 -e 'my $foo = "bar"; my %bar = :42foo, :70bar; dd [$foo => %::($foo)]'
[:bar({:bar(70), :foo(42)})]

$ ./perl6 -e 'my $foo = "bar"; my %bar = :42foo, :70bar; dd [:%::($foo)]'
===SORRY!=== Error while compiling -e
Variable '%::($foo)' is not declared
at -e:1
------> = "bar"; my %bar = :42foo, :70bar; dd [:⏏%::($foo)]

$ ./perl6 -v
This is Rakudo version 2018.01-204-gbeaad7b built on MoarVM version 2018.01-94-gc7774e3
implementing Perl 6.c.

The %::($foo) construct is already parsed as a variable and colonpairs can handle them, but looks like the colonpair token simply assumes it can strigify the Match of the variable to get its name: $<var><desigilname>.Str

@zoffixznet zoffixznet self-assigned this Feb 16, 2018

@jnthn

This comment has been minimized.

Member

jnthn commented Feb 16, 2018

One thing to be aware of: :$foo is a named parameter in the context of an argument list, and we need to know our named parameter names at compile time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment