digitalmars.D - Dangling Else, Yet Again
- Andrei Alexandrescu (2/2) Sep 22 2011 http://www.reddit.com/r/programming/comments/kooiy/dangling_else_yet_aga...
- Nick Sabalausky (7/9) Sep 22 2011 "It works by keeping track of any lexically enclosing statement that is
- deadalnix (12/14) Sep 23 2011 This is a great idea. I'm used to use tools like checkstyle in java (or
http://www.reddit.com/r/programming/comments/kooiy/dangling_else_yet_again/ Andrei
Sep 22 2011
"Andrei Alexandrescu" <SeeWebsiteForEmail erdani.org> wrote in message news:j5gv0j$825$1 digitalmars.com...http://www.reddit.com/r/programming/comments/kooiy/dangling_else_yet_again/ Andrei"It works by keeping track of any lexically enclosing statement that is looking for an else clause, so if an else clause is found for the current statement without a following { }, then it is marked as illegal." Can someone explain that for me? (My brain is completely scrambled right now from a nasty Flash/IE bug.)
Sep 22 2011
Le 23/09/2011 05:38, Andrei Alexandrescu a écrit :http://www.reddit.com/r/programming/comments/kooiy/dangling_else_yet_again/ AndreiThis is a great idea. I'm used to use tools like checkstyle in java (or some others depending on the language) that trigger an error if an if statement without brace contain any conditionnal (if, for, while, . . .) or as an else. It makes the code myuch more clearer and avoid stupid mistake that sometime are hard to discover. Including this at the parser level is a great idea. The D's solution is softer than mine, but this is a good thing. At parser level, you should only limit what is error prone, not ensure coding quality standards that can vary from a devellopper to another. Good job. deadalnix
Sep 23 2011