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

Re: First look: Advanced Polymorphism whitepaper

Thread Previous | Thread Next
From:
John M. Dlugosz
Date:
April 28, 2008 12:21
Subject:
Re: First look: Advanced Polymorphism whitepaper
Message ID:
25291-12046@sneakemail.com
Jon Lang dataweaver-at-gmail.com |Perl 6| wrote:
> Ah; that clears things up considerably.  If I understand you
> correctly, John is using '£' to mean "use Duck Typing here".  _That_,
> I can definitely see uses for.  As well, spelling it as 'like' instead
> of '£' is _much_ more readable.  With this in mind, the above
> signature reads as "$p1 must be like a Point, but it needn't actually
> be a Point.  Both $p2 and the return value must be the same type of
> thing that $p1 is."
>
> What, if anything, is the significance of the fact that pointlike (in
> John's example; 'Point' in TSa's counterexample) is generic?
>
>   

It is designed for coping with generics and virtual types that have been 
redefined by the base class.  It works for structural "duck" typing too, 
using the same algorithm.

The example shows that it needs to figure out what T must be, and help 
show how generic classes don't have the proper "isa" because the types 
change in each specialization.

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