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

LTA `.=` metaop is sensitive to whitespace when using on implicit $_ #2373

Open
zoffixznet opened this issue Oct 14, 2018 · 1 comment

Comments

Projects
None yet
3 participants
@zoffixznet
Copy link
Contributor

commented Oct 14, 2018

For some time, I was under impression that .= metaassign op doesn't work with implicit $_, because when I write it the usual way, I get an error:

<Zoffix_> m: my $x = 42; .= flip with $x
<camelia> rakudo-moar 1beb7d4e7: OUTPUT: «===SORRY!=== Error while compiling <tmp>␤Preceding context expects a term, but found infix .= instead.␤at <tmp>:1␤------> my $x = 42; .=⏏ flip with $x␤»

However, that's because (IIRC) the .= exists in the grammar as both a fake infix and a methodop and the spacy version thinks I wrote an infix. If I omit whitespace, then the construct works just fine:

<Zoffix_> m: my $x = 42; .=flip with $x; dd $x
<camelia> rakudo-moar 1beb7d4e7: OUTPUT: «Str $x = "24"␤»

I think it'd be nice to make it DWIM with the whitespace case

@jnthn

This comment has been minimized.

Copy link
Member

commented Oct 14, 2018

I think we could make this work. Agree that now that we also allow spaces around . for method calls elsewhere it also feels relatively consistent to have it DWIM.

@lucasbuchala lucasbuchala added the metaop label Mar 15, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.