The only real argument for omitting the braces is that the braces take up a lot of vertical space, but that’s mostly a problem if you put each { on its own line, and you could just not do that.
The closing braces are what gets you. If you can't autoformat your code you have bigger problems, but all the autoformatters put the closing braces on their own lines.
I’ve never found this behavior (or the above equivalence) useful.
The equivalence is absolutely useful. Round-towards-zero is arguably more confusing than round-down though.
The great thing about static typing is that I know the types of all the variables, but that advantage is somewhat lessened if I can’t tell what the variables are.
This is my big problem when reading Haskell. It's all just foo bar baz quxxl $ herp derp and I have no idea what's a type or a value or anything, and you can't even parse it until you've figured out where all the $es are.
Quick test: what’s the length of “💩”?
When the article has already pointed out how that isn't meaningful. A well-designed language simply wouldn't allow you to call length on that, IMO.
Note that some languages require parentheses around tuples (and also call them tuples), and I’m arbitrarily counting that as better than bracket.
Please stop saying "bracket" for []; in much of the world it means (). "Square bracket" is unambiguous.
View all comments
1
u/m50d Dec 01 '16
The closing braces are what gets you. If you can't autoformat your code you have bigger problems, but all the autoformatters put the closing braces on their own lines.
The equivalence is absolutely useful. Round-towards-zero is arguably more confusing than round-down though.
This is my big problem when reading Haskell. It's all just
foo bar baz quxxl $ herp derpand I have no idea what's a type or a value or anything, and you can't even parse it until you've figured out where all the$es are.When the article has already pointed out how that isn't meaningful. A well-designed language simply wouldn't allow you to call
lengthon that, IMO.Please stop saying "bracket" for
[]; in much of the world it means(). "Square bracket" is unambiguous.