develooper Front page | perl.perl6.language | Postings from April 2008

Re: First look: Advanced Polymorphism whitepaper

Thread Previous | Thread Next
From:
chromatic
Date:
April 30, 2008 21:54
Subject:
Re: First look: Advanced Polymorphism whitepaper
Message ID:
200804302153.29057.chromatic@wgz.org
On Wednesday 30 April 2008 08:56:24 Ovid wrote:

> > That was always my goal for roles in the first place.  I'll be a
> > little sad if  Perl 6 requires an explicit notation to behave correctly
> > here -- that is, if the default check is for subtyping, not polymorphic
> > equivalence. 

> I had initially thought this, but think about the case where someone
> wants to rewrite something to be compliant to another interface.  If I
> pass a CGI::Simple object to a method expecting a CGI object, there's
> an excellent chance that it will *just work*, even though there's no
> relation between the two.

Sure; ad hoc polymorphism allows for cognates.  Not all cognates are false 
cognates.  (If no cognates were false, duck typing would work in a 
correctness sense.  Sadly, both trees and dogs bark.)

> In this case, a role really doesn't work.

I think that's a non sequitur.  There's no allomorphism in your example.

This is why roles-as-types is so important: type inferencers can't infer 
allomorphism because allomorphism relies on explicitly-marked semantic 
meanings.

-- c

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About