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

'self' isn't the invocant in role methods called with the self.Role::method syntax in Rakudo #3013

Closed
p6rt opened this issue Dec 28, 2012 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Dec 28, 2012

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

Searchable as RT116226$

@p6rt
Copy link
Author

p6rt commented Dec 28, 2012

From @masak

<doy> r​: role Foo { method bar { "ROLE​:" ~ (self.defined ?? "D" !!
"U") } }; class Bar does Foo { method bar { "CLASS​:" ~ (self.defined
?? "D" !! "U") ~ "-" ~ self.Foo​::bar } }; say Bar.new.bar
<p6eval> rakudo c8de2e​: OUTPUT«CLASS​:D-ROLE​:U␤»
<doy> ^^ bug?
<doy> or is there another way i'm supposed to be doing that call
<masak> doy​: in-ter-es-ting.
<masak> doy++
* masak submits rakudobug
<masak> r​: role Foo { method bar { say self.WHICH } }; class Bar does
Foo { method bar { say self.WHICH; self.Foo​::bar } }; Bar.new.bar
<p6eval> rakudo c8de2e​: OUTPUT«Bar|549956910␤Foo␤»
<masak> I'd argue 'self' should still be the original invocant, even
in the role method.
<doy> agreed
<masak> r​: role Foo { method baz { say self.WHICH } }; class Bar does
Foo { method bar { say self.WHICH; self.baz } }; Bar.new.bar
<p6eval> rakudo c8de2e​: OUTPUT«Bar|1974449900␤Bar|1974449900␤»
<masak> ...and it's particular to the self.Role​::meth syntax. bingo.

@p6rt
Copy link
Author

p6rt commented Jan 9, 2013

From @jnthn

On Fri Dec 28 06​:00​:45 2012, masak wrote​:

<doy> r​: role Foo { method bar { "ROLE​:" ~ (self.defined ?? "D" !!
"U") } }; class Bar does Foo { method bar { "CLASS​:" ~ (self.defined
?? "D" !! "U") ~ "-" ~ self.Foo​::bar } }; say Bar.new.bar
<p6eval> rakudo c8de2e​: OUTPUT«CLASS​:D-ROLE​:U␤»
<doy> ^^ bug?
<doy> or is there another way i'm supposed to be doing that call
<masak> doy​: in-ter-es-ting.
<masak> doy++
* masak submits rakudobug

Fixed; it now gives​:

CLASS​:D-ROLE​:D

As expected. Tagging testneeded.

Thanks,

/jnthn

@p6rt
Copy link
Author

p6rt commented Jan 9, 2013

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

@p6rt
Copy link
Author

p6rt commented Jan 12, 2013

From @moritz

Tested in the ever-growing S14-roles/basic.t

@p6rt
Copy link
Author

p6rt commented Jan 12, 2013

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

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