develooper Front page | perl.perl5.porters | Postings from April 2012

Re: proposal: functional C<if>

Thread Previous | Thread Next
From:
Zefram
Date:
April 27, 2012 10:06
Subject:
Re: proposal: functional C<if>
Message ID:
20120427170638.GD4237@lake.fysh.org
Eric Brine wrote:
>One could say this is more of a problem with "/" than with "if" expression,

Also a problem with "+", "-", "*" and "<".  No, it's a problem with
if-as-expression.

>Which brings me to my point. Would it be bad if "if" expression always
>required leading "+"

Liable to be confusing.

>(last statement of sub or block excepted, of course)?

This makes no sense.  I don't see how the special status of the last
statement of a block is at all relevant to if-as-expression.

>Concise existing mechanism providing visual cue of meaning. It has it all.

if-as-expression as you propose it still provides the misleading clue
of ending with "}", and moreover "}" preceded by a statement, which is
unusual for an expression.  do{} is misleading in the same way, and I
think we shouldn't repeat the mistake.

Mandatory surrounding parens would be a better cue.  Less confusing
(because less unusual) than mandatory unary +, and it makes the end of
the expression look like, er, the end of an expression.

-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