Re: [Vala] Documenting 'async' / WAS: Further speculations on couroutines, generators and threads : Emulating Go's goroutines and channels in Vala

2011-07-15 Thread Serge Hulne
I am right in assuming that: 2. Async methods have virtually no use outside the scope of event-driven GTK+ applications (except perhaps as a way to implement additional Vala features like Luca Bruno's generator, but at the cost of runtime-performance). 3. There is always a way to write an

Re: [Vala] Documenting 'async' / WAS: Further speculations on couroutines, generators and threads : Emulating Go's goroutines and channels in Vala

2011-07-15 Thread Jim Peters
Luca Bruno wrote: All correct. Thanks. Question: At the C level, I guess this first calls forwards to 'other_method' to start it before returning to the caller due to the 'yield'. If the 'other_method' also yields, then there is no problem, but if 'other_method' finishes

Re: [Vala] Documenting 'async' / WAS: Further speculations on couroutines, generators and threads : Emulating Go's goroutines and channels in Vala

2011-07-15 Thread Luca Bruno
On Fri, Jul 15, 2011 at 11:34:17AM -0500, Jim Peters wrote: Can you rephrase? We can call 'method' either like this: method(); or like this: method.begin(); or like this: method.begin((obj, res) = { method.end(res); }); In the first two cases,

[Vala] EOF problems

2011-07-15 Thread Stefan Risberg
I am trying to read a file char by char but I can't find where or how I can check if end of line (EOF) was found. I'm writing a simple parser for a project but I can't seem to find in the online api doc of gio or glib how to check for it. I saw that I can do it using posix, but I would rather

Re: [Vala] EOF problems

2011-07-15 Thread Luca Bruno
On Fri, Jul 15, 2011 at 10:57:21PM +0200, Stefan Risberg wrote: I am trying to read a file char by char but I can't find where or how I can check if end of line (EOF) was found. I'm writing a simple parser for a project but I can't seem to find in the online api doc of gio or glib how to check

Re: [Vala] Documenting 'async' / WAS: Further speculations on couroutines, generators and threads : Emulating Go's goroutines and channels in Vala

2011-07-15 Thread Jim Peters
Luca Bruno wrote: In the first two cases, is the .end() handled automatically? Looking at the generated code, it doesn't seem so. Could this be a problem? For example, could this cause a leak? It's not a problem. Thanks. I've created a new page on the wiki trying to make the 'async'

Re: [Vala] EOF problems

2011-07-15 Thread san hoi
python's case : https://gist.github.com/f0ff2c3c66e6a5842e70 python return '' as EOF. but I don't know how to do well it with vala... Sorry that I can't be of a help. 2011/7/16, Luca Bruno lethalma...@gmail.com: On Fri, Jul 15, 2011 at 10:57:21PM +0200, Stefan Risberg wrote: I am trying to

Re: [Vala] Documenting 'async' / WAS: Further speculations on couroutines, generators and threads : Emulating Go's goroutines and channels in Vala

2011-07-15 Thread Serge Hulne
Congratulations to Jim Peters on his excellent job about documenting async methods in Vala ! Thank you very much ! Question about combining async and threads in the generator example: - Would it be possible to combine the last two examples for the following purpose: - In the last example, the