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

Extended identifiers without keys raise "You can't adverb" error #2948

Open
taboege opened this issue Jun 3, 2019 · 1 comment
Open

Extended identifiers without keys raise "You can't adverb" error #2948

taboege opened this issue Jun 3, 2019 · 1 comment

Comments

@taboege
Copy link
Contributor

taboege commented Jun 3, 2019

The Problem

The following code raises You can't adverb &infix, but the docs on extended identifiers list it as valid. It is stated there that "[t]hese strings have the form :key, wherein key or value are optional". Here, the key is missing:

say &infix:('+');  #= You can't adverb &infix

With a key, it works as expected:

my $x:bar<2> = 10;
say $x:bar(1+1);  #= 10

but fails when bars are removed:

my $x:<2> = 10;
say $x:(1+1);  #= Variable '$x' is not declared

bisectable only turned up a commit where the error message changed. It was an error on Christmas already.

@taboege
Copy link
Contributor Author

taboege commented Jun 13, 2019

FWIW, French quotes don't trigger the adverb error:

my $sym = "+";
say &infix:«$sym»;  #= &infix:<+>

and they furnish a full workaround to the above problem thanks to expression interpolation:

my $x:<2> = 10;
say $x:«{1+1}»;  #= 10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant