On Thu, 01 Jun 2017 16:07:41 -0700, ju...@tnx.nl wrote:
> 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.

Reply via email to