by virtualwhys · 7y ago · 0 comments
The TS version has zero type safety (compiler infers any), whereas the RML version will only accept numeric type arguments.
let sum = (a, b) => a + b;
actually accepts only arguments of type int, not any numeric type. The + operator is defined as let (+): (int, int) => int;
To have the function accept floats, for example, you would have to use the +. operator like this let sum = (a, b) => a +. b;I guess a clearer distinction between the two can be nice, but then how does that compile to javascript?