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 11:13
Subject:
Re: First look: Advanced Polymorphism whitepaper
Message ID:
15309-44954@sneakemail.com
Jon Lang dataweaver-at-gmail.com |Perl 6| wrote:
> I'm having some difficulty understanding the business with £.  I
> _think_ that you're saying that £ sort of acts as a prefix operator
> that changes the meaning of the type with which it is associated; and
> the only time that a change in meaning occurs is if the type in
> question makes use of ::?CLASS or a generic parameter.
>
>   
Not only generic parameters, but overridden virtual type names too.  In 
general, type names can be changed by derived classes just like methods.



> You say that in Perl 6, a role normally treats ::?CLASS as referring
> to the role.  
No, ::?CLASS refers to the actual class.  Maybe you're confused because 
a footnote said to pretend it stood for the role when using the role 
itself as a type, because it does not exist at all.


>
> As for classes and roles that have generic parameters: here, you've
> completely lost me.  How does your proposed '£' affect such classes
> and roles?
>
>   

The pointlike[::T] role has a generic parameter.
The concrete class Point3D[Rat] matches "pointlike", and it figures out 
that to make the match work that T has to be Rat.
It figures out that FoxPoint is pointlike, if it uses Num for T.



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