develooper Front page | perl.perl6.language | Postings from May 2004

Re: C style conditional statements

Thread Previous | Thread Next
From:
Larry Wall
Date:
May 11, 2004 19:13
Subject:
Re: C style conditional statements
Message ID:
20040512021323.GA16352@wall.org
On Tue, May 11, 2004 at 08:31:55PM -0400, Andrew Rodland wrote:
: On Tuesday 11 May 2004 08:00 pm, Pedro Larroy wrote:
: > Hi
: >
: > Is there any chance that in perl6 there will be the possibility to write
: > if/else statements without {}s with the condition at the beginning?
: >
: > Like
: >
: > if (condition)
: > 	statement;
: >
: > In order not to break traditional C culture. Is there any technical
: > reason why it wasn't done in perl5?
: 
: My understanding is that it was mostly a /(counter)?cultural/ decision, to 
: make dangling-else syndrome impossible. For the same reason "else if" is 
: spelled "elsif", so there doesn't have to be a special braceless exception 
: for "else".
: 
: It might also be wise to note that if your statement is really that simple and 
: important, you might be better off writing "statement if condition".
: 
: Yes, I know that I'm diverting rather than strictly answering. My personal 
: opinion is that I can live with it, because I've shot myself in that 
: particular foot before, and that there are good reasons. My other opinion is 
: that I wouldn't mind if a particular rule in the grammar could be enabled / 
: disabled with "use strict 'braces'" either, as it is somewhat unperlish to 
: prevent footshooting for that sake alone.

That's gonna be pretty unlikely.  We've basically decided that, in
terms of readability, it makes a whole lot more sense to get rid of
the parens than the curlies, and you can't make both the parens and
the curlies optional.

Perl 1 had to maintain a lot of compatibility with C for general
acceptance (the bracketing rule being a glaring exception to that).
We think that nowadays we can edge away from some of the less useful
C heritage, as long as we stay close enough to our Perl heritage.
(Some would say we've already blown it there... :-)

Larry

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