in reply to No braces
I didnt see this mentioned already so ill say it here: Dangling else!
if ($x==7) if ($x==8) $x=0 else $x=7
Which way to parse this? Is the else for the inner or outer if? Well, there are rules to disambiguate that are typical, I believe the else goes with the innermost if by convention for instance. But overall the simplest solution is to do away with the problem entirely. By saying that the result of a loop or conditional is ALWAYS a block you never have the problems that you encounter by saying it may be a statement OR a block.
And no, I bet you a hundred bytes that this wont change a bit. Larry was wearing his real smart hat when he made this rule up. Using statement modifiers he provided the statement form, and the rest uses the block form. They look different a bit, but thats the idea, they do slightly different things and thus they should look different.
First they ignore you, then they laugh at you, then they fight you, then you win.
-- Gandhi
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: No braces
by Abigail-II (Bishop) on Feb 11, 2004 at 19:37 UTC | |
by demerphq (Chancellor) on Feb 11, 2004 at 22:24 UTC | |
by hhdave (Beadle) on Feb 12, 2004 at 23:20 UTC |