Completely off topic but, after doing python for ages, recently started writing Rust and semicolon does seems useless. We are doing the indentation and new lines anyway, why not just make them as default language construct as python does. (autodidact developer here, feel free to ELI5 and enlighten me)
x = some_long_expression
+ another_long_expression
problem? In Python you need to be careful to wrap that in () or use a \ before the newline to avoid it parsing as two lines, e.g. x = some_long_expression;
+ another_long_expression;
In particular, if you have a builder expressions let x = someBuilder()
.setVal(x)
.build()
You'd need to wrap the entire thing in () to avoid it getting mad, right?So if you're going to terminate expressions with ), and start them with (, why not just terminate them with ; instead?
Javascript is a "Semicolons Optional" language, but it's actually the worst of both worlds, as you have to be very careful not to wrap lines like
function() {
some stuff;
return
really_long_named_thing;
}
As it'll just insert a ; on the return, returning undefined for you.