"Casey R. Tweten" wrote:
> 
> This looks counter intuitive, my brain says to dereference the reference at the
> begining, just like you make the reference, in other words, keep it all the
> same:
> 
> $hashref->{key}->@ # Deref
> $hashref->{key}->$ # Deref
> $hashref->{key}->% # Deref
> $hashref->{key}->* # Deref
> $hashref->{key}->& # Deref
> $hashref->{key}->\ # Reference

I think of dereferencing something as an action applied to something; it
requires only the thing that you're dereferencing. I do not think of
referencing as an action, because it's really operating on the
environment in which the thing you're referencing exists. Trying to make
it operate only on its argument would be like trying to take the address
of a value in a register. So I don't see a conflict.

As for $x->\ specifically, I'm also thinking of -> as a dereferencing
operator, not a labelling operator, so I would find $x->\ rather bizarre
but I guess it should be a no-op, because you're referencing the result
of dereferencing $x. (In that order, so it would be an error if $x were
not a reference to begin with.)

Hm. I never considered that possibility before. I think of the @ in ->@
as specifying the type of dereferencing to perform, or equivalently, the
"context" in which to evaluate the result of (generic) -> dereferencing.
I guess you're thinking of @ as the dereferencing operator, and -> is
just separating things out? So it's like our legs, in that they're two
bony things that keep our torsos away from the ground. I guess that way
of thinking is more in line with the usage of @ in @$x.

Well, then, what do you think of promoting -> from a pretty prop to an
actual dereferencing operator? :-)

Reply via email to