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 23:08
Subject:
Re: proposal: functional C<if>
Message ID:
20120428060813.GA20370@lake.fysh.org
Eric Brine wrote:
>Actually, it does. It's the very definition of an expression.

Not in Perl.  We're concerned here with the *syntactic* distinction
between statements and expressions, and in that sense "if" is currently
only a statement.  In the semantic sense of returning a value, however,
Perl is an everything's-an-expression language.  The op tree doesn't
strongly distinguish between statements and expressions; the same op type
is used for if-statement and ?:.  Perl statements always return values
(though those values are usually discarded).

-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