4 ms·
It is my understanding "yield" refers to "execution control". If semantic meaning is of concern over lexical, let us ignore the names "coroutine" and "generator
by davidhollander 16y ago
It is my understanding "yield" refers to "execution control". If semantic meaning is of concern over lexical, let us ignore the names "coroutine" and "generator" and focus on the general logic of code continuation. That is, the difference between pausing the current execution context vs destroying it.
Function call: halt further processing of current call stack, execute procedures, resume call stack after function call when control returns.
Yield: halt further processing of current call stack, execute procedures, resume call stack after yield when control returns.
Return: destroy current call stack.
The variation present on the code continuation axis is far more significant than the variation on the coughing-up-values axis.
- tsellon 16y agoI think, in this case, 'yield' is being used less in the sense of a street sign, and more in the sense of crop yield.