develooper Front page | perl.perl5.porters | Postings from August 2013

Re: postfix dereference syntax

Thread Previous | Thread Next
August 15, 2013 20:19
Re: postfix dereference syntax
Message ID:
Aaron Priven wrote:
>Then whatever you had in $foo, it could be dereferenced, into whatever
>it is -- scalar, hash, array, glob, etc. There's no ambiguity there,
>is there?

There are two kinds of ambiguity that that would cause.  Firstly,
overloading of operators @{}, %{}, et al, mean that a single reference
can indeed be dereferenced in multiple ways.  Secondly, the semantics
of several operators depends on *compile-time* knowledge of the type
of an operand, but your proposed dereference-to-anything operator means
that the resulting type isn't known until runtime.  A dereference-to-any
operand either (sane version) would not be eligible for use with operators
requiring an array/hash/whatever, or (insane version) would require many
new op types to be added that defer to runtime the decisions that are
currently made at compile time.

It's all the same problem we ran into with auto-dereferencing "keys $r".


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About