Ter, 2008-04-29 às 21:03 -0500, John M. Dlugosz escreveu:
> In response to questions on my whitepaper, I made this companion
> to bring people up to speed on the issue.
> <http://www.dlugosz.com/Perl6/web/isa-inheritance.html>
Very interesting reading... :)
It actually made me think that it would be possible to implement it as a
pragma.
class A { has $.a };
class B { has $.b };
sub foo { A $a } { ... }
{
foo(B.new()); # FAIL
use typematch 'like';
foo(B.new()); # OK
use typematch 'does';
foo(B.new()); # FAIL
}
This could be achieved simply by scope-redefining
infix:<~~>(Object,Object) to use another implementation.
(Note that I'm trying at all costs to avoid adding that as a signature
trait, because that would complicate the dispatching ;)
daniel