|
|
|
|
|
by 19eightyfour
3275 days ago
|
|
I'm thinking of it in the way that the interpreter works in JavaScript with tasks. If you setTimeout(A, 0), inside B, then after B returns, A is called, but any other tasks previously inserted into the queue are called first. So I think that means I was asking about execution in the same context (as in memory context), unless you mean stack frame by context, in which case, I think i understand that because the caller returns the value of the deferred, they are in the same stack frame, and nothing else could insert in that frame between them. I'm not sure you know what i mean, but do i have it about right? I don't really understand this, but i think I'm getting somewhere. |
|
This simple example should explain everything:
Here is the output: All defers run in LIFO order at the point when a function returns before the function returns execution back to the caller.