On Thu, May 06, 2004 at 01:52:45PM -0400, Dan Sugalski wrote:
: At 10:44 AM -0700 5/6/04, chromatic wrote:
: >On Thu, 2004-05-06 at 10:39, Aaron Sherman wrote:
: >
: >> The simple case is:
: >>
: >>    sub foo(X $i is rw) {...}
: >>    class X {...}
: >>    class Y {...}
: >>    my Y $var = 'something';
: >>    foo($var);
: >>
: >> In this case, something kind of interesting has to happen.
: >>
: >> Either the signature checking has to verify that Y isa X (and thus can
: >> be used polymorphically as X, not just converted to X) ...
: >
: >I'd argue 'Y does X', actually, though Dan disagrees and says "Well,
: >whatever!"
: 
: Nope. Dan says "Is that X in the signature an assertion of interface 
: or of parentage?" and has the Perl 6 compiler emit the appropriate 
: code. (Parentage is the safer option generally, since only in perl 6 
: is the class == interface assertion going to be true, and you might 
: want to be able to yank in Python/Ruby/Perl5/Objective-C/Java/C#/C++ 
: objects and classes. Or... you might not, which is fine too)

I don't see a problem with using "does" sematics in Perl 6 because
roles and classes live in the same namespace, and "does" naturally
devolves to "isa" semantics if you hand it a class.  So we just
"render unto classes the things that are class's, and unto roles the
things that are role's", as it were.  So the X in the signature is
always an assertion of interface, which may or may not care about
parentage--and which may care about *extra* things if X is a subtype
that adds constraints.  But subtypes also live in the same namespace
as classes and roles, so again, we know almost immediately what kind
of checking is required.

Larry

Reply via email to