Re: [Vala] The state of closures




On 28/04/11 16:08, Luca Bruno wrote:
On Thu, Apr 28, 2011 at 03:58:32PM +0100, Sam Liddicott wrote:
This feature may be less useful for vala if it does stack-tear-down
for interruptable functions, but perhaps more suited if it uses
co-routines with different stacks so that the stack is switched and
not torn-down when an interruptable function is interrupted.
Yes that's the problem, with vala you may pass the closure to another
function and exit from the current scope, while with gcc nested function
the stack is lost once you exit the outer function.

And it's hard to control this or know when it is happening by accident.

I wonder if it is worth considering libpcl or other co-routine libraries - it would take away the need for a lot of effort to get fuller closure support.

I've also been thinking of ways to detect when vala closures go stale - one way is for the data pointer to be indirected via a heap allocated pointer. This could be set to null by the outer function when it exits, and so any use after this point can be detected - as when the wrapper trampoline function is executed it will detect that the data pointer points to NULL instead of pointing to the actual data pointer.

Sam





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]