On Wed, 25 Apr 2001 06:09:56 -0700 (PDT), Larry Wall wrote:

>Bart Lateur writes:
>: Er... hip hip hurray?!?!
>: 
>: This is precisely the reason why I came up with the raw idea of
>: highlander variables in the first place: because it's annoying not being
>: able to access a hash passed to a sub through a hash reference, in the
>: normal way. Not unless you do aliasing through typeglobs.

>: But, if there won't be full blown highlander variables, how does Perl
>: know if by $foo{THERE} you mean an item of the hash %foo, or a item in a
>: hash referenced by the hashref $foo?
>
>$foo{THERE} always means the hashref in $foo.  %foo{THERE} always means
>the hashref in %foo.  %foo by itself in scalar context means a hashref.
>@foo by itself in scalar context means an arrayref.  &foo by itself in
>a scalar context means a coderef.  It's gonna be pretty consistent.

Yeah. But no cheers then. The problem still remains: you can access a
hash in the normal way in plain code, but inside a sub, you can mainly
only access a passed hash through a reference.

It's annoying to basically having two ways of doing something, and one
of them can't be used half of the time.

Even though @foo and %foo may be two different structures, a scalar $foo
can only reference one of them at a time.

Are you going to provide a simpler aliasing mechanism to turn a hash
reference, for example as passed to a sub as an argument, back into the
full-blown hash? Simpler (and safer) than the much frowned upon
assignment to a tyeglob, that is.

-- 
        Bart.

Reply via email to