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

Warning about $. when using metamethod #6303

Closed
p6rt opened this issue Jun 1, 2017 · 6 comments
Closed

Warning about $. when using metamethod #6303

p6rt opened this issue Jun 1, 2017 · 6 comments

Comments

@p6rt
Copy link

p6rt commented Jun 1, 2017

Migrated from rt.perl.org#131478 (status was 'resolved')

Searchable as RT131478$

@p6rt
Copy link
Author

p6rt commented Jun 1, 2017

From @Juerd

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

@p6rt
Copy link
Author

p6rt commented Oct 7, 2017

From @skids

On Thu, 01 Jun 2017 16​:07​:41 -0700, juerd@​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 rakudo/rakudo#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.

@p6rt
Copy link
Author

p6rt commented Oct 7, 2017

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Nov 17, 2017

From @AlexDaniel

I'm guessing that this now needs tests?

On 2017-10-07 07​:35​:53, bri@​abrij.org wrote​:

On Thu, 01 Jun 2017 16​:07​:41 -0700, juerd@​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 rakudo/rakudo#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.

@p6rt
Copy link
Author

p6rt commented Dec 11, 2017

From @zoffixznet

Tests​: Raku/roast@e7962eb855

@p6rt
Copy link
Author

p6rt commented Dec 11, 2017

@zoffixznet - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Dec 11, 2017
@p6rt p6rt added the testneeded label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant