3 ms·
A few years ago, I came up with a similar proposal, though more specifically aimed at making callbacks easier to manage. It was a simple syntax extension, as op
by Arkadir 12y ago
A few years ago, I came up with a similar proposal, though more specifically aimed at making callbacks easier to manage. It was a simple syntax extension, as opposed to new semantics for the language.
You would write this:
var! x = expression;
statement;
statement;
And JavaScript would parse it as:
return expression.then(function(x) {
statement;
statement;
});
This is obviously shamelessly pilfered from monadic syntax 'let!' in F#, and my own 'let!' extension in OCaml.