develooper Front page | perl.perl5.porters | Postings from November 2010

Re: [PATCH] Add "safe arrow/safe dereference" operator: &&->

Thread Previous | Thread Next
From:
Zefram
Date:
November 28, 2010 11:15
Subject:
Re: [PATCH] Add "safe arrow/safe dereference" operator: &&->
Message ID:
20101128191519.GA24925@lake.fysh.org
Rafael Garcia-Suarez wrote:
>Yes, I think that &&-> is a very good spelling.

It seems a poor spelling to me.  It is rather bulky to go between
tokens with typically no whitespace around it (as "->" is usually used).
The "&&" part suggests a pretty low precedence, whereas in fact it'll be
in the highest-precedence group of all.  The "&&" also suggests that the
behaviour will be controlled by truth-value interpretation of the LHS,
which is not the case.  The only thing the "&&" part has going for it
is that it correctly suggests the short-circuiting, but short-circuiting
operators are not exclusively doubled punctuation, so there's not really
a strong call for that kind of spelling for that reason.

I favour "-&>".  It looks, as it should, like a modified arrow.
It doesn't visually break into two separate-looking operators.  Its ends
are suitable for it to have no surrounding whitespace, like "->".
Because of the close resemblance to "->" it gives the right precedence
expectation.  It has no awkward truth-value connotation.

-zefram

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About