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

Re: First look: Advanced Polymorphism whitepaper

Thread Previous | Thread Next
From:
John M. Dlugosz
Date:
May 2, 2008 16:19
Subject:
Re: First look: Advanced Polymorphism whitepaper
Message ID:
2685-09993@sneakemail.com
Larry Wall larry-at-wall.org |Perl 6| wrote:
>
> If a role is derived from a class,
According to S12: 

"A role may not inherit from a class..."

>  it must of necessity be a snapshot
> of the class, because roles are immutable, while classes are not.
> The only interesting question in my mind is whether you can take
> another snapshot and override the previous one somehow, or whether
> such derived roles should version themselves so that the snapshots
> can be distinguished by longname.  Alternately, we make one snapshot
> when a class is first composed, and refuse to make any other snapshots
> for that name regardless of how the class under that name changes.
>
> Larry
>
>   

But, the way I see it, the "item" listed in the role that says

     is Base;

is declaring it from the point of view of the eventual class that 
composites the role.  It will be processed when a class is defined by 
playing back the metaobject instructions to create a class, just like 
you had said "is Base" in that class's block at THAT TIME.

The definition of the role simply files away "is Base" for later, and 
doesn't look to see what's in Base now for purposes of seeing which 
symbols are already available.

No need for keeping track of snapshots.

How's that?

--John

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