Norbert Nemec wrote:
Regan Heath wrote:
So, these generators are essentially inline functions?
No. They may be inlined, but this is just an optimization just like for
regular functions. If they are not inlined, these generators are simply
functions with a special calling convention that allows them to retain
their local data and execution point on the stack in between calls.
I did work out the assembly code for this some time ago and it worked
nicely. Very similar to what is needed for co-routines, but it is
possible to do everything on the stack.
How is that different from a local delegate that refers to local variables of
the function it is lexically nested in?