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

Re: postfix dereference syntax

Thread Previous | Thread Next
Father Chrysostomos
August 14, 2013 06:08
Re: postfix dereference syntax
Message ID:
Ricardo Signes wrote:
> I also think, and I imagine this will raise some hackles, that we should
> support this syntax in interpolation.  

I am opposed.

I do not see that it offers that much over existing interpolation.
The main thing I like about ->@* is that it allows an arbitrary
expression before it, as in [1..3]->@* or foo()->@*.  Interpolation
does not help in those circumstances.

Interpolation is always introduced with a sigil that indicates what
type of interpolation is happening.  If we start putting that at the
end, then it’s all backwards.  It’s hard to explain.  It just doesn’t
feel right.

Also, where do we stop?  What about "$my_sub->()"?

Since interpolation juxtaposes code with literal text with no inter-
vening operators or delimiters, I think it is important to keep it
conceptually simple.  It is already a mental burden to deal with the
difference between /$a[1]/ and /$a[123]/.  Please don’t complicate it
further.  We already have too many exceptions to remember.

>   "Or $x->@{....}"

I have used such constructs when debugging method calls.  And debug-
ging code is not always temporary code.

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