Re: [Vala] [Async] why use .begin ?

2009-09-19 Thread Didier "Ptitjes"
Jan Hudec wrote: > I didn't notice that thing -- it's indeed good tool for the job. I would > still prefer something to mark in the source that we are synchronizing an > async function. Maybe a .sync() "submethod" to match .begin() and .end() and > state clearly what is happening: .sync() is exact

Re: [Vala] [Async] why use .begin ?

2009-09-19 Thread Jan Hudec
On Sat, Sep 19, 2009 at 15:40:16 +0200, Didier Ptitjes wrote: > Jan Hudec wrote: > > I can imagine a special syntax that will make vala generate this might be > > accepted in future. My suggestion would be > > > > var result = yield sync foo_async(); > > I guess I would propose: > > var resu

Re: [Vala] [Async] why use .begin ?

2009-09-19 Thread Didier "Ptitjes"
Jan Hudec wrote: > I can imagine a special syntax that will make vala generate this might be > accepted in future. My suggestion would be > > var result = yield sync foo_async(); I guess I would propose: var result = foo_async(); We talked about that on IRC today with Jürg, and it may be po

Re: [Vala] [Async] why use .begin ?

2009-09-19 Thread Jan Hudec
On Sat, Sep 19, 2009 at 01:41:34 +0200, Michael 'Mickey' Lauer wrote: > > No, the call without .begin() is being deprecated. > > > > >From yestarday's discussion on IRC I understood it's not generally possible > > to collapse to synchronous call automagically. Doing it involves running > > a (recu

Re: [Vala] [Async] why use .begin ?

2009-09-18 Thread Yu Feng
Please someone elaborates on .begin / .end in the tutorial. The async story is missing in it. - Yu On Fri, 2009-09-18 at 20:10 +0200, Jan Hudec wrote: > On Fri, Sep 18, 2009 at 19:52:59 +0200, JM wrote: > > What does .end() do? Are there any examples available? > > It's a syntax for the _finish

Re: [Vala] [Async] why use .begin ?

2009-09-18 Thread Jürg Billeter
On Sat, 2009-09-19 at 01:41 +0200, Michael 'Mickey' Lauer wrote: > > No, the call without .begin() is being deprecated. > > > > >From yestarday's discussion on IRC I understood it's not generally possible > > to collapse to synchronous call automagically. Doing it involves running > > a (recursive

Re: [Vala] [Async] why use .begin ?

2009-09-18 Thread Michael 'Mickey' Lauer
> No, the call without .begin() is being deprecated. > > >From yestarday's discussion on IRC I understood it's not generally possible > to collapse to synchronous call automagically. Doing it involves running > a (recursive) main loop until the callback is called, but this brings a lot > of proble

Re: [Vala] [Async] why use .begin ?

2009-09-18 Thread Jan Hudec
On Fri, Sep 18, 2009 at 20:33:44 +0200, JM wrote: > Can you also say something about > > async_function.callback > > I've seen it in the dbus test, but I don't fully understand it yet. That's a delegate, of the SourceFunc type. If you use the bare yield statement, that is: yield; The

Re: [Vala] [Async] why use .begin ?

2009-09-18 Thread JM
Ah. ok. Can you also say something about async_function.callback I've seen it in the dbus test, but I don't fully understand it yet. Regards Jörn Am Freitag, den 18.09.2009, 20:10 +0200 schrieb Jan Hudec: > On Fri, Sep 18, 2009 at 19:52:59 +0200, JM wrote: > > What does .end() do? Are

Re: [Vala] [Async] why use .begin ?

2009-09-18 Thread Jan Hudec
On Fri, Sep 18, 2009 at 19:52:59 +0200, JM wrote: > What does .end() do? Are there any examples available? It's a syntax for the _finish function. Takes the AsyncResult and return the real result or throws an error (if the async function does). It's called like async_function.end(result) in

Re: [Vala] [Async] why use .begin ?

2009-09-18 Thread JM
Hello What does .end() do? Are there any examples available? Please also put some information to the tutorial. That would be great! Thanks Jörn > No, the call without .begin() is being deprecated. > > >From yestarday's discussion on IRC I understood it's not generally possible > to collapse to sy

Re: [Vala] [Async] why use .begin ?

2009-09-18 Thread Jan Hudec
On Fri, Sep 18, 2009 at 18:34:47 +0200, Michael 'Mickey' Lauer wrote: > On Friday 18 September 2009 18:18:33 JM wrote: > > Hi all > > A few days ago I edited the asynchronous stream reading example on the > > vala site to use the new async syntax. > > http://live.gnome.org/Vala/GIOSamples#head-a617

Re: [Vala] [Async] why use .begin ?

2009-09-18 Thread JM
Ok. Thanks! PS.: Can someone who knows the async stuff better than me write a few lines about .begin and .end to the vala tutorial? Regards, Jörn Am Freitag, den 18.09.2009, 18:34 +0200 schrieb Michael 'Mickey' Lauer: > On Friday 18 September 2009 18:18:33 JM wrote: > > Hi all > > A few days ago

Re: [Vala] [Async] why use .begin ?

2009-09-18 Thread Michael 'Mickey' Lauer
On Friday 18 September 2009 18:18:33 JM wrote: > Hi all > A few days ago I edited the asynchronous stream reading example on the > vala site to use the new async syntax. > http://live.gnome.org/Vala/GIOSamples#head-a6170c01121b9fe5825f431de73573b0 >84545741 > > After the release of vala-0.7.6 I rea

[Vala] [Async] why use .begin ?

2009-09-18 Thread JM
Hi all A few days ago I edited the asynchronous stream reading example on the vala site to use the new async syntax. http://live.gnome.org/Vala/GIOSamples#head-a6170c01121b9fe5825f431de73573b084545741 After the release of vala-0.7.6 I realized that other examples of the new syntax use '.begin()' t