develooper Front page | perl.perl6.language.subs | Postings from September 2000

Re: RFC 324 (v1) Extend AUTOLOAD functionality to AUTOGLOB

Thread Previous
From:
Nathan Wiger
Date:
September 29, 2000 13:03
Subject:
Re: RFC 324 (v1) Extend AUTOLOAD functionality to AUTOGLOB
Message ID:
39D4F56F.5B3AF900@west.sun.com
David Cantrell wrote:
> 
> You can do it by explicitly calling your parent's AUTOGLOB as well if you're
> asked to deal with something you don't support yourself (see below).  Also,
> having it as a single sub would be more easily extensible if we ever have
> more datatypes (I think!) and results in less pollution of the namespace.
> 
> ...
> if($type_of_thing eq 'scalar') {
>         # do some stuff
> } else {
>         SUPER::...
>         # use our parent's AUTOGLOB
> }

Yeah, but then you have to rewrite the sub and call SUPER:: or NEXT::
explicitly. It breaks encapsulation in a big way. Really, it should be
avoided at all costs. There's lots of -objects RFC's that fix stuff like
this, but your proposal of a single AUTOGLOB would break them.

We've already got 50+ special subs, 3 extra ones for AUTO* buys you a
lot and doesn't cause namespace pollution worth worrying about. Plus
what's the probability that someone is going to want to name their sub
"AUTOHASH" anyways?

Matching with

   if($type_of_thing eq 'SCALAR')   # would be ref type

is kludgey at best. And the likelihood that other fundamental types will
be added to Perl is pretty low. Plus, I would think we'd want to control
what was auto-globbable.

-Nate

Thread Previous


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