Re: [Vala] Implicit lamdas/closures



On Mon, 2008-11-03 at 20:15 +0000, Sam Liddicott wrote:
Jürg, I'll call your stuff "async" and mine "callbacks".

You're right that I can do most of what I need with continuation
lamdas.

Perhaps I could abuse the keyword pair "continue inline" to cause the
lambda to invoke the main body at the correct point.

(I'm not sure how you are generating the continue entry points, but if
you are using wrapper functions, then the continuation lambda would
just be a way of specifying the body, type signature and name of that
wrapper, instead of whatever the async model would do)

The code is all in a single function and a switch statement jumps to the
right statement.

I would also need to use something like the keyword yield to specify a
continuation point and that the return should not free the closure.

I could probably do without the yield blocks I suggested and have
"continue inline" refer to the next yield statement, thus avoiding
polluting the language too much; 

despite this though I think the yield bocks are safer as they ensure
that the  "continue inline" lambda is specified in the yield block and
prevents the callback occuring in a diffent block by careless placing
of the next yield statement 

So it seems that "continue inline" and yield blocks are the only
outward language polutions I'm proposing, and maybe not yield
blocks...

One major concern I have is how do you intend to pass values returned
from the callback back to the main method? The parametrized continue you
proposed seems to be too cryptic, do you have an alternative idea?

Jürg




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