From: | Chris Jepeway <jepeway [...] blasted-heath.com> |
Subject: | Roles can't use stub methods to indicate "must implement" methods: calls to such methods always ambiguous |
Date: | Sat, 25 Apr 2015 19:20:00 -0400 |
To: | rakudobug [...] perl.org |
Trying to tell doers of a role that they are expected to implement a method (a là Java interfaces) doesn’t seem to work. This
role A { multi method a(Int $i) {...}; multi method a(Str $s) {...}; }; class B does A { multi method a(Int $i){0}; multi method a(Str $s) {"a"}; } ; B.new.a(0).say
yields:
Ambiguous call to 'a'; these signatures all match:
:(B $: Int $i, *%_)
:(B $: Int $i, *%_)
in block
<unit> at /tmp/0ILm1pfWyW:1
Both TimToady and timotimo suspect this to be a bug. See
http://irclog.perlgeek.de/perl6/2015-04-22#i_10480886
for their discussion.
Chris.