tamejs
tamejs copied to clipboard
return-based syntax
It would be nice to have a return
-based syntax to make async programming even more comfortable.
function foo(host) {
await dns.resolve(host, 'A', defer(var err, ip));
return ip;
}
var ip = await foo('github.com');
Implementing it should be rather easy since all the preprocessor has to do is transforming the code like this before performing whatever it already does:
function foo(host, cb) {
await dns.resolve(host, 'A', defer(var err, ip));
cb(ip);
}
await foo('github.com', defer(var ip));
Then how do you actually return something from an async function. i.e. promises?