> =head1 TITLE
   > 
   > Positional Return Lists Considered Harmful
   > 
   > The solution is simple: return hashes instead of lists.  Yes, one
   > still has to know how the fields are named, so the proposed solution
   > is still not perfect.

I *fully* support this idea. A suggestion though:

        return hash (references) *as well as* lists.

I've proposed that the want() function will be able to distinguish
a HASHREF context (there the return value is used as a hash reference).
Retain the list return (which is convenient why one does know what
(caller(0))[4] does), and have the named return values returned via
a hash reference when such a context is active.

E.g.:

        $package = caller;                              # scalar context
        ($package, $file, $line, $subname) = caller(0); # list context
        $subname = caller(0)->{subname};                # hashref context

Damian

Reply via email to