Re: [Vala] Coroutines / async methods - info needed for talk



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):

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)


Regards,

Frederik



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