[Vala] Proposal for an improved delegate/lambda handling

2008-10-18 Thread Ali Sabil
Hi all, I would like to start a discussion about a small syntactic sugar addition to Vala, that would in my opinion slightly improve the situation with asynchronous code. The following code sample should be self explanatory about my proposal: delegate bool HttpResponseCallback (string response);

Re: [Vala] Proposal for an improved delegate/lambda handling

2008-10-18 Thread Christian Hergert
What about methods that take 2 callbacks? -- Christian 2008/10/18 Ali Sabil <[EMAIL PROTECTED]>: > Hi all, > > I would like to start a discussion about a small syntactic sugar addition to > Vala, that would in my opinion slightly improve the situation with > asynchronous code. The following code

Re: [Vala] Proposal for an improved delegate/lambda handling

2008-10-18 Thread Ali Sabil
Since it is just syntactic sugar, you are free to pass 2 callbacks as parameters or put 2 "pseudo-lambda" expressions after the method call. -- Ali On Sat, Oct 18, 2008 at 11:09 PM, Christian Hergert < [EMAIL PROTECTED]> wrote: > What about methods that take 2 callbacks? > > -- Christian > > 200

Re: [Vala] Proposal for an improved delegate/lambda handling

2008-10-18 Thread Yu Feng
On Sat, 2008-10-18 at 22:57 +0200, Ali Sabil wrote: > Hi all, > > I would like to start a discussion about a small syntactic sugar > addition to Vala, that would in my opinion slightly improve the > situation with asynchronous code. The following code sample should be > self explanatory about my p

Re: [Vala] Proposal for an improved delegate/lambda handling

2008-10-18 Thread Christian Hergert
I like it. Might get confusing if someone wanted to mix direct delegates and anonymous ones though. -- Christian On Sat, Oct 18, 2008 at 4:14 PM, Yu Feng <[EMAIL PROTECTED]> wrote: > On Sat, 2008-10-18 at 22:57 +0200, Ali Sabil wrote: >> Hi all, >> >> I would like to start a discussion about a sm

Re: [Vala] Proposal for an improved delegate/lambda handling

2008-10-19 Thread Ali Sabil
Here is another set of proposed syntaxes, so that the post_request() looks like this: client.post_request("GET ") { debug ("Got Response: %s", response); } { debug ("Got error: %s", error); } Another possible syntax would be: client.post_request("GET ...") { (response) => {

Re: [Vala] Proposal for an improved delegate/lambda handling

2008-10-19 Thread Sam Liddicott
. Sam -Original Message- From: Ali Sabil <[EMAIL PROTECTED]> Sent: 19 October 2008 11:31 To: Christian Hergert <[EMAIL PROTECTED]> Cc: Vala Mailing list Subject: Re: [Vala] Proposal for an improved delegate/lambda handling Here is another set of proposed syntaxes, so that the

Re: [Vala] Proposal for an improved delegate/lambda handling

2008-10-19 Thread Yu Feng
ain. local_unref(local); return; } Yu > > Sam > > > > __ > From: Ali Sabil <[EMAIL PROTECTED]> > Sent: 19 October 2008 11:31 > To: Christian Hergert <[EMAIL PROTECTED]> > Cc: Vala Mailing list > Subjec

Re: [Vala] Proposal for an improved delegate/lambda handling

2008-10-19 Thread Sam Liddicott
That's pretty much where I'd got up to. I was also trying to use libffi for it's trampoline for data-less callbacks ___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list

Re: [Vala] Proposal for an improved delegate/lambda handling

2008-10-19 Thread Sam Liddicott
abil <[EMAIL PROTECTED]>; Christian Hergert <[EMAIL PROTECTED]>; Vala Mailing list Subject: Re: [Vala] Proposal for an improved delegate/lambda handling On Sun, 2008-10-19 at 14:19 +0100, Sam Liddicott wrote: I like any method that allows the callback block to acess all variables

Re: [Vala] Proposal for an improved delegate/lambda handling

2008-10-19 Thread Yu Feng
over continuation style code, but might > not favour signal handler style events, but perhaps they are actually a > different case anyway... > > Sam > > > -Original Message- > From: Yu Feng <[EMAIL PROTECTED]> > Sent: 19 October 2008 15:40 > To: Sam

Re: [Vala] Proposal for an improved delegate/lambda handling

2008-10-19 Thread Sam Liddicott
gnal handler style events, but perhaps they are actually a different case anyway... Sam -Original Message- From: Yu Feng <[EMAIL PROTECTED]> Sent: 19 October 2008 15:40 To: Sam Liddicott <[EMAIL PROTECTED]> Cc: Ali Sabil <[EMAIL PROTECTED]>; Christian Hergert <

Re: [Vala] Proposal for an improved delegate/lambda handling

2008-10-20 Thread Sam Liddicott
* Sam Liddicott wrote, On 20/10/08 07:24: > Yu Feng wrote: >> BTW, there is an erudite description on closures (about javascript) at >> MDC: >> http://developer.mozilla.org/en/A_re-introduction_to_JavaScript#Closures >> >> > I'm slightly puzzled that I gave the impression that I was confused on