3 ms·
The Javascript 1.7 coroutine/generator syntax is copied verbatim from Python. I agree this seems like a weird choice, since Javascript is much more function-or
by kilovoltaire 14y ago
The Javascript 1.7 coroutine/generator syntax is copied verbatim from Python.
I agree this seems like a weird choice, since Javascript is much more function-oriented than Python.
As for needing to send() first to get it started, this kind of makes sense given that the same syntax is used for generators as well, so there is kind of an off-by-one difference between generators (which return a value from the first send()) and coroutines (which tend not to return values).