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

Re: First look: Advanced Polymorphism whitepaper

Thread Previous | Thread Next
From:
TSa
Date:
April 29, 2008 01:21
Subject:
Re: First look: Advanced Polymorphism whitepaper
Message ID:
4816DA5B.5010304@barco.com
HaloO chromatic,

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

What is "polymorphic equivalence" to you? I remember us discussion the
issue of duck typing versus nominal typing. I'll try to dig that out.
But here is a version from memory using John's pointlike role:

   %h<x y new midpoint> = T.new(1), T.new(2), &new, &midpoint;

where &new and &midpoint refer to code objects with applicable
signature. Then I think that we have

    %h.does(Point) === False;
    %h.like(Point) === True;

with the second test being more elaborate and hence more expensive.

Regards, TSa.
-- 

"The unavoidable price of reliability is simplicity"  -- C.A.R. Hoare
1 + 2 + 3 + 4 + ... = -1/12  -- Srinivasa Ramanujan

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