3 ms·
Reason still looks like an ML-style language rather than something from the C family of things (where JavaScript ultimately comes from). For example, in Reason
by atombender 1y ago
Reason still looks like an ML-style language rather than something from the C family of things (where JavaScript ultimately comes from).
For example, in Reason, a function is:
let x: (int, int) => int = (a, b) => a + b;
A more JS-like syntax might be:
fn x(a, b int): int {
a + b
}
Or at least:
let x = fn(a, b int): int {
a + b
}
- debugnik 1y agoBut the Reason example you shared is almost valid TypeScript already! https://www.typescriptlang.org/play/?#code/DYUwLgBAHgXBAUBDOA7ArgWwEYgE4BoItVMdcBKCAXgD4J1s9qFFCtLaJEIBqIgbiA https://www.typescriptlang.org/play/?#code/DYUwLgBAHgXBAUBDO... I've seen JS using lambdas instead of classic functions like that in the wild. And that Reason can be made more JS-idiomatic without changes to the syntax: let x = (a: int, b: int): int => a + b;