develooper Front page | perl.perl5.porters | Postings from May 2008

Re: thoughts about overloading method calls

Thread Previous | Thread Next
From:
Reini Urban
Date:
May 7, 2008 14:53
Subject:
Re: thoughts about overloading method calls
Message ID:
482224BB.3020801@x-ray.at
Ricardo SIGNES schrieb:
> * Reini Urban <rurban@x-ray.at> [2008-05-07T06:19:20]
>> 2008/5/6 Ricardo SIGNES <perl.p5p@rjbs.manxome.org>:
>>>  A truly anemic start would be to write classes with no methods save for
>>>  AUTOLOAD.  Unfortunately, AUTOLOAD does not catch universal methods.  This
>>>  is worse than just having to write a "can" and "isa."  If anything in your
>>>  process loads UNIVERSAL::{moniker,require} or Sub::Install, or any of a
>>>  number of other things that muck with UNIVERSAL, your code will change in
>>>  bizarre ways.
>> I would just write something along "no autoload"
>> Autovification of method calls should be pragmatized, being able to turn it
>> off.
> 
> One of us is confused.
> 
> What I meant was "I can't use AUTOLOAD to autovivify /all/ methods, because it
> will never be able to autovivify methods found in UNIVERSAL."
> 
> It seems like you're suggesting a solution to the opposite problem.

Not really. A better object system should throw away AUTOLOAD
and autovification of methods. Just as kurila did.
Linda W started a thread some time ago about the problems with 
destructivily checking methods inheritance. (can is destructive)
Not possible with perl5 semantics because of AUTOLOAD.

So I proposed "no autoload" and on top of that write your Class:Metameta.
It would let you have a clear distinction between class and object methods.

-- 
Reini Urban
http://phpwiki.org/  http://murbreak.at/

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