Trends in modern programming language syntax
rdallasgray.github.io
rdallasgray.github.io
This is one thing that really annoys me with Coffeescript. I personally find the lack of parentheses makes the code harder to read (since it's sometimes ambiguous where the parentheses should be) but faster to write.
> An important consequence of this is implicit returns: because every construct must return a value, all functions must return a value, whether return is called explicitly or not.
Same concern here. When working with someone else's code, it is sometimes unclear if the author intended the last expression to be the return value or it just happened to be the last line of code and it is safe to return something else.
The lack of parentheses and implicit returns also makes it hard to maintain a consistent code style guide as there are too many ways of writing the same thing.
I wonder if this is why I like scheme, or if scheme is why I like simple syntax.
> I personally find the lack of parentheses makes the code
> harder to read [...] but faster to write.
Then simply use parentheses. They're still there for you to rely on as much as you'd like to. One main reason why they're optional is so that things flow together nicely with the significant whitespace, like so: filter list, (item) ->
if item.flag is 'priority'
item.visible
else
false
... writing the above with all parentheses present wouldn't be quite as nice -- and I don't think any clearer to read.return unless x is 5
"reads" like
if( x !== 5 ) return;
but I guess it's more like
return (x !== 5);
Go is more of a C-like counter example of the things the author is talking about, with its authoritarian use of K&R curly brace formatting, and not making statements into expressions.