Closed alfonsogarciacaro closed 5 years ago
If we don't have type inference or auto-generalization for arguments, most of the times you will need to add the parens in the declaration though:
let square (x: number) = x * x
Upon reflection, maybe it's better not to do this a it can create a very inconsistent style: 0 arguments, empty parens; one argument, no parens; two or more arguments, parens...
I would prefer to make the parens mandatory so the syntax is consistent. When you have a function it will all be written using let myFunc (....) = ....
In #5 we've decided to use parens for functions with multiple arguments. However, and even if I want to avoid multiple alternatives for the same thing (especially at the beginning), given that the syntax will be ML-like, it may help to make the parens optional when there's only a single argument.
Disadvantages:
.map(x => x + 2)
.f[2]
) which would force us to use a dot as in F#:ar.[2]
(Ocaml uses dot and parensar.(2)
, ReasonML uses parens always for application so they don't need the dot in indexing).