Reason - general function syntax discussion

I fall squarely in the “spaces are better than parens for function application” camp, for two reasons:

  1. use tuples a lot in my project, so not only will I hit the worst-case scenario f((x,y)) quite a bit it’ll also be fairly confusing for a while after the change
  2. I believe the space syntax lends itself better to partial application, which I find to be a solid benefit of ML style languages and I use it all the time. With brackets function application has a defined start and end point, I’m not aware of any languages that have brackets and partial application. I really hate syntax like f(x)(y) which I’ve seen some JS developers do. This is somewhat backed up by let-def’s statement that the intention is to move away from curried application.

Now, having said all that, I’m in favour of this change. There are enough other improvements here - single colons for named arguments, removing fun for ES6 style anonymous functions - that if parenthesis for function application is the cost of having them I’m willing to put up with it.

Anecdotally I’ve seen a few JS developers comment that while Reason is similar, it’s not similar enough. I’m still a bit worried that long term this change will make things harder than they need to be for use cases like mine but overall I think this is a good direction.

5 Likes