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 03:19
Subject:
Re: thoughts about overloading method calls
Message ID:
6910a60805070319r63ef3bc1i3168cb1d48d773f2@mail.gmail.com
2008/5/6 Ricardo SIGNES <perl.p5p@rjbs.manxome.org>:
>  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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About