Closed co-dh closed 12 years ago
add(3) 4
and (add 3) 4
both do what you want. White space is treated as application, it's just right-associative, not left-associative, which makes way more sense than the alternative.
I don't agree right-associative makes more sense than left. suppose you are using CPS programming, as in http://en.wikipedia.org/wiki/Continuation-passing_style you'll find left-associative is a must. Also CPS is used a lot in node.js
You do realize that changing that would break practically any CS code ever written, right?
Thanks. Interesting. personally I prefer coffeescript's syntax.
On Wed, Nov 23, 2011 at 4:41 AM, Satoshi Murakami reply@reply.github.com wrote:
Try http://roy.brianmckenna.org.
Reply to this email directly or view it on GitHub: https://github.com/jashkenas/coffee-script/issues/1886#issuecomment-2846711
If it's a mistake, the early we correct it, the better. Anyway, didn't coffee script breaks all javascript code that already written? Also, a simple convert could be write to convert right associative to leve associative.
It's not a mistake, just a design-level decision. I believe coffee's wide audience is a little too wide for such a change. Have a look at this search of projects on github which use coffee-script ;)
If you want Haskell, you know where to find it. ;D
In all seriousness, though, I think left-associative is a better fit for a language that means to retain JavaScript's semantics. The Wiki has a big list of other languages that compile to JavaScript, including a few versions of Haskell and OCaml, that might be a better fit for your needs.
add 3 4
will be parsed asadd (3 4)
, which apply 3 as a function to 4 . the only way to get parsed is :which has too may braces.
I suggest to change the syntax, so white space is treated as application.