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

Using `%.foo` in places throws, but changing it to `self.foo` works #2152

Open
zoffixznet opened this issue Jul 30, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@zoffixznet
Copy link
Contributor

commented Jul 30, 2018

Seems like changing % to self works in the cases shown below. Could not the %.foo form work as well?

18:43 | xinming | m: class A { has %.h = (a => 1) }; class B is A { submethod BUILD () { %.h = (b => 1) } }; B.new
18:43 | camelia | rakudo-moar f045042d4: OUTPUT: «=== SORRY!===   Error while compiling <tmp>␤Virtual method call %.h may not be  used on partially constructed object (maybe you mean %!h for direct  attribute access here?)␤at <tmp>:1␤------>  class B is A { submethod BUILD () { %.h ⏏  = …»
18:43 | xinming | m: class A { has %.h = (a => 1) }; class B is A { submethod BUILD () { self.h = (b => 1) } }; B.new.h.perl.say;
18:43 | camelia | rakudo-moar f045042d4: OUTPUT: «{:b(1)}␤»



18:53 | Zoffix | m: class A { has %.h = (a => 1); has %.b = %.h }.new.b.say;
-- | -- | --
18:53 | camelia | rakudo-moar f045042d4: OUTPUT: «=== SORRY!===   Error while compiling <tmp>␤Virtual method call %.h may not be  used on partially constructed object (maybe you mean %!h for direct  attribute access here?)␤at <tmp>:1␤------> ss A { has %.h = (a => 1); has %.b = %.h ⏏  }.…»
18:53 | Zoffix | m: class A { has %.h = (a => 1); has %.b = self.h }.new.b.say;
18:53 | camelia | rakudo-moar f045042d4: OUTPUT: «{a => 1}␤
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.