"Walter Bright" <newshou...@digitalmars.com> wrote in message news:j313kp$1fc1$1...@digitalmars.com... > On 8/19/2011 8:12 AM, Andrei Alexandrescu wrote: >> One thing I'd subjectively like is to require braces on both branches of >> if/else >> if at least one has braces. > > It's rather simple to just disallow the form: > > if (a) if (b) statement > ^ error: use if(a&&b) or if(a){if(b)statement} > > and not even pay attention if there's a dangling else or not. I've always > viewed things like: > > if (a) > if (b) > ... > ... > > with suspicion, anyway, dangling else or not.
Oh god no, don't ban that. I *like* to do that sort of thing: if(useThisFeature) foreach(x; 0..100) foreach(y; 0..100) if(blah blah long thing) if(simple unrelated condition) if(hell, maybe even another) statement(); Absolutely beats the hell out of: if(useThisFeature) { foreach(x; 0..100) { foreach(y; 0..100) { if(blah blah long thing with the simple unrelated condition requiring ugly line breaks and screwy formattng/alignment in a big pita to read uber-expression. fuck this shit. It looks ok in english, but in code the damn thing reads like a fucking regex) { statement(); } } } }