Mattias Holm wrote:
Walter Bright wrote:
S. wrote:
I find it strange that people are continuing to reinvent nested
functions in ugly ways.
The blocks are not nested functions, they are more like closures.
Nested functions do closures in a straightforward way, so by leaving off
nested functions they were forced to make an ugly syntax <g>. This is
why I shake my head in just not understanding the process that led to
their design.
There
are some block copy functions that move a block to the heap (including
the captured variables).
Nested functions can usually not be called after the defining function
have returned. You cannot return blocks directly (since they are located
on the stack), but you can return a heap copy of the block.
This is handled in D automatically.