Is there any attempt to bring async/await feature from C# 5.0 to any language which can be compiled to JavaScript (such as CoffeScript)? (So it can be used
When Node 0.11 (with v8 3.19 [1], which has generators[2]) arrives, you can use Galaxy and code like below.
However, only behind a flag. They are supported natively in ioJS.
function* countLines(path) {
var names = yield fs.readdir(path);
var total = 0;
for (var i = 0; i < names.length; i++) {
var fullname = path + '/' + names[i];
if ((yield fs.stat(fullname)).isDirectory()) {
total += yield countLines(fullname);
} else {
var count = (yield fs.readFile(fullname, 'utf8')).split('\n').length;
console.log(fullname + ': ' + count);
total += count;
}
}
return total;
}
function* projectLineCounts() {
var total = 0;
total += yield countLines(__dirname + '/../examples');
total += yield countLines(__dirname + '/../lib');
total += yield countLines(__dirname + '/../test');
console.log('TOTAL: ' + total);
return total;
}