Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm not sure what's with OP, but according to [1] (and the example on tasks.js) a generator-producing function should have an asterisk before the name.

  function *myCoroutine() { ... }
1. http://www.2ality.com/2012/07/esnext-classes.html


So, in lieu of the new function* syntax, the presence of the yield keyword in the body is the only thing that distinguishes a generator from a regular function, in the current Firefox implementation?


Cool, I didn't know about that syntax!

Unfortunately it isn't yet supported in Firefox, but I'm glad something like that is in the works.


Hope I didn't offend. I really enjoyed your post; the coroutine syntax seems like an extraordinarily intuitive approach to state machines. Game-changing, maybe. Look forward to trying it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: