FAQ
# New Ticket Created by "Carl Mäsak"
# Please include the string: [perl #116226]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=116226 >


<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.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupperl6-compiler @
categoriesperl
postedDec 28, '12 at 2:00p
activeDec 28, '12 at 2:00p
posts1
users1
websiteperl6.org

1 user in discussion

Carl Mäsak: 1 post

People

Translate

site design / logo © 2018 Grokbase