4 ms·
The only strong feeling I have here, is that where it exists in a language it shouldn't be optional. "Optional syntax" is potentially confusing syntax. One of
by techdragon 5y ago
The only strong feeling I have here, is that where it exists in a language it shouldn't be optional.
"Optional syntax" is potentially confusing syntax. One of the nice things about code formatters like Black, rust-fmt and gofmt is that they say "do it this way" with respect to potentially optional syntax like this exact brace/no-brace issue.
I primarily work in Python, so i don't write a lot of "braced" code like this, but where I do, in languages like C# and so on, I'll always use the braces, its just clearer. I'm sticking to the explicit is better than implicit rule thats served me so so well over the years. I do it with braces, i even do it with imports, I'm that weird person off in the corner writing C# that uses fully qualified names instead of doing module imports, I cant stand the overly implicit behaviour of the imports in dotNet. Explicit wins for me every time ( Except for writing my own SQL ;-) )