For the love of god, please do not use single-line alternatives to braced scopes. It’s only tolerable in lambdas like Array.map( v => v**2 ). It’s not for an implicit scope. It’s for evaluating a return value.
But holy shit is it nice to have ?. in Javascript. It’s such an anything-goes language until you look at it funny and it just shits the bed and silently dies. Hate hate haaate having to check if things exist, when so many other details fail politely and impact nothing. At least now it’s one extra character instead of try-catch rigmarole.
I’m fine with non-braced blocks, but they must always be on the same line as the parent statement (e.g. if (a != null) returna) to visually distinguish them. (inb4 argument about long conditions: they’d usually be spread out over several lines, and the statement would go on the closing parenthese (which is on a line by itself when split over multiple lines))
For the love of god, please do not use single-line alternatives to braced scopes. It’s only tolerable in lambdas like
Array.map( v => v**2 )
. It’s not for an implicit scope. It’s for evaluating a return value.But holy shit is it nice to have
?.
in Javascript. It’s such an anything-goes language until you look at it funny and it just shits the bed and silently dies. Hate hate haaate having to check if things exist, when so many other details fail politely and impact nothing. At least now it’s one extra character instead of try-catch rigmarole.I’m fine with non-braced blocks, but they must always be on the same line as the parent statement (e.g.
if (a != null) return a
) to visually distinguish them. (inb4 argument about long conditions: they’d usually be spread out over several lines, and the statement would go on the closing parenthese (which is on a line by itself when split over multiple lines))We avoid that, because just at a glance you might not see the function flow change when returns are at the end of lines. It’s a minor thing of course.
Inb4 the JavaScript fanboys appear and argue a bad tool is fine if you’re a genius, actually. Why aren’t you a genius?