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

Reply via email to