Dangling Else, Yet Again

deadalnix deadalnix at gmail.com
Fri Sep 23 02:35:28 PDT 2011


Le 23/09/2011 05:38, Andrei Alexandrescu a écrit :
> http://www.reddit.com/r/programming/comments/kooiy/dangling_else_yet_again/
>
> Andrei

This 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


More information about the Digitalmars-d mailing list