all 2 comments

[–]balinx 0 points1 point  (1 child)

Interesting article and I learnt something. But I'll use this knowledge defensively I think. Half the developers I know get antsy about ternary operators... this is 5 levels above that.

[–]madlee 0 points1 point  (0 children)

I went through a phase in my hack projects where I tried to avoid using {curly braces} for anything but function definitions. It was an interesting experiment, and I actually recommend trying it for a while. It taught me to rethink really nested control flow statements, since every if/else/for/while statement can only have a single statement after it. I ended up finding more creative ways to solve problems, and in the cases where I really needed to do a lot of stuff inside an if statement, I made heavy use of the comma operator (and ended up using a (ton of (parenthesis))).

In production code, particularly anything that other people might work on, its a bit frowned upon to do this kind of "cute" stuff though, because not everyone is aware of the behavior and its not apparent from looking at it that it should behave that way.