* Frederik wrote, On 11/03/09 10:38:
Me too, and I don't even know if it is because the vala is invalid because I can't find clearer examples or instructions.Sam Liddicott wrote:I've come up with this Vala example to help me see what is going on: using GLib; int foo (int y) yields { int x; x=1; message ("hello"); yield; y=2; message ("world"); yield; y=3; message ("thats all folks"); return 5; } void main () { foo.begin (0); message ("vala"); var loop = new MainLoop (null, false); loop.run (); }Does this compile for you? For me it doesn't (latest Vala from git): Yeah, but it can still be instructive to look at the generated C - but not only does it not compile, it looks wrong too, when you try and make sense of the C - and I don't just mean the stepped switch/case statement in foo_co which looks abominable and surely will interleave badly with any vala case statements.async.c: In function 'foo': async.c:32: error: 'data' undeclared (first use in this function) async.c:32: error: (Each undeclared identifier is reported only once async.c:32: error: for each function it appears in.) async.c:35: error: case label not within a switch statement async.c:41: error: case label not within a switch statement async.c: In function 'foo_co': async.c:83: error: 'x' undeclared (first use in this function) async.c:89: error: 'y' undeclared (first use in this function) error: cc exited with status 256 Compilation failed: 1 error(s), 0 warning(s) Sam |