Skip Menu |
Report information
Id: 131478
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: juerd [at] tnx.nl
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: Warning about $. when using metamethod
From: "Juerd Waalboer" <juerd [...] tnx.nl>
To: rakudobug [...] perl.org
Date: Fri, 2 Jun 2017 01:02:16 +0200
code: class Command { method Str { "<$.^name>" } } # or even just: class Command { method Str { $.^name } } gives: Unsupported use of $. variable; in Perl 6 please use the .kv method on e.g. .lines workaround: self.^names 00:41 < Juerd> "Unsupported use of $. variable; in Perl 6 please use the .kv method on e.g. .lines" when trying $.^name instead of self.^name; bug or my mistake? 00:50 < AlexDaniel> Juerd: bug. 00:53 < AlexDaniel> Juerd: I think this is where you would fix it: https://github.com/rakudo/rakudo/blob/8e0d000fbbe1a1430695ac5dbed5bce505d89a05/src/Perl6/Grammar.nqp#L2080-L2083 00:54 < AlexDaniel> like, maybe this: !before ‘^’? \w 00:55 < Juerd> Mind if I copy/paste that into a ticket? 00:55 < AlexDaniel> sure -- Met vriendelijke groet, // Kind regards, // Korajn salutojn, Juerd Waalboer <juerd@tnx.nl> TNX
Download (untitled) / with headers
text/plain 1.2k
On Thu, 01 Jun 2017 16:07:41 -0700, juerd@tnx.nl wrote: Show quoted text
> code: > > class Command { method Str { "<$.^name>" } } > # or even just: > class Command { method Str { $.^name } } > > gives: > > Unsupported use of $. variable; in Perl 6 please use the .kv method on > e.g. .lines > > workaround: > > self.^names > > > 00:41 < Juerd> "Unsupported use of $. variable; in Perl 6 please use > the .kv method on e.g. .lines" when trying $.^name > instead of self.^name; bug or my mistake? > 00:50 < AlexDaniel> Juerd: bug. > 00:53 < AlexDaniel> Juerd: I think this is where you would fix it: > https://github.com/rakudo/rakudo/blob/8e0d000fbbe1a1430695ac5dbed5bce505d89a05/src/Perl6/Grammar.nqp#L2080- > L2083 > 00:54 < AlexDaniel> like, maybe this: !before ‘^’? \w > 00:55 < Juerd> Mind if I copy/paste that into a ticket? > 00:55 < AlexDaniel> sure
That syntax simply hadn't been implemented yet. PR https://github.com/rakudo/rakudo/pull/1178 submitted to implement it. Note that a side-effect of that PR is that even when you are not in a class, you have to use e.g. ($).^mro if you want to introspect an in-place anonymous variable... which is probably not something many people would ever want to do, so not a big deal.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org