# reply in initial and final and other good stuff. resource hmmm const int N = 10000 body hmmm(int x, cap (int x) {send} c) # c's main purpose is to make output deterministic. write("initial",x) reply destroy myresource() write("OOPS, shouldn't get here",x) final { write("final start",x) if (x > 0) { cap hmmm c op done(int x) {send} c = create hmmm(x-1,done) int y receive done(y) if (y-N == x-1) { write("ok",y) } else { write("OOPS", y) } } write("final end",x) send c(x+N) } end resource main import hmmm body main() process p { write("start p") cap hmmm c op done(int x) {send} c = create hmmm( 5, done ) int y receive done(y) if (y-hmmm.N == 5) { write("ok",y) } else { write("OOPS", y) } write("end p") } end