Why didn't they simplify it (and make it more like current JS) by leaving out the .send() method?
Wouldn't this make more sense?
var tester = test;
tester();Wouldn't this make more sense?
var tester = test;
tester(); var tester = test();
tester();
And yeah I agree, straight functions seem way nicer, which is what the coroutine() wrapper in the writeup ends up accomplishing.Javascript 1.7 copied the generator/coroutine objects straight from Python, and it's a weird fit...
One thing that you can't do with just a function is have the .close() method, which may or may not be a fundamental issue.
The reason that might be less good than the current approaches is that you may want to spawn multiple 'instances' of the generator/coroutine. If I'm understanding your proposal correctly, you'd only ever be able to run it once.