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 03:19
Re: thoughts about overloading method calls
Message ID:
2008/5/6 Ricardo SIGNES <>:
>  Today, I was doing some mucking about with class data, generated packages, and
>  Class::ISA, and I started to wail and gnash my teeth.  I cried, "Why can't I
>  just replaced the darn object system?"
>  It would let me use any kind of MRO I wanted, including some crazy MRO that I
>  only want in one extreme case.  It would let me do truly classless OO, avoiding
>  the pseudo-anonymous "classes" created by things like Package::Generator.  It
>  would let me have a clear distinction between class and object methods.
>  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.
Reini Urban

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