develooper Front page | perl.perl5.porters | Postings from February 2009

Re: method names clash by importing: next step

Thread Previous | Thread Next
From:
Abigail
Date:
February 25, 2009 03:56
Subject:
Re: method names clash by importing: next step
Message ID:
20090225115638.GD7518@almanda
On Wed, Feb 25, 2009 at 11:48:07AM +0000, Zefram wrote:
> Rafael Garcia-Suarez wrote:
> >So we could just say that a method declared with :method will not be
> >clobberred by an imported non-method.
> 
> That would break compatibility.  Currently it's valid to import a sub
> that is intended to be used as a method.


It won't break compatibility, as currently neither the method, nor the
imported sub will have the :method attribute.

As I understand Rafaels proposal, if package A inherits from B, and imports
from C, and if B has a sub "foobar" with the :method attribute, and C
exports a sub "foobar" *without* the :method attribute, A->foobar() calls
"foobar" in B, not in C (as it currently will).

If the exported sub from C has the ":method" attribute, or the "foobar"
sub in B doesn't have the ":method" attribute, A->foobar() calls "foobar"
in C.


Abigail

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