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

Re: thoughts about overloading method calls

Thread Previous | Thread Next
Reini Urban
May 7, 2008 14:53
Re: thoughts about overloading method calls
Message ID:
Ricardo SIGNES schrieb:
> * Reini Urban <> [2008-05-07T06:19:20]
>> 2008/5/6 Ricardo SIGNES <>:
>>>  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

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About