/* Combining the pointer-transferring buffer and the memory manager */ tl; resource mm (f) [list(f)] { f = NULL; } alloc(x;) { with mm when(true) { if(f==NULL) x = new(); else { x = f; f = x->tl; }} } [x|->] dealloc(y) [y|->] { with mm when(true) { y->tl = f; f = y; } } resource buf (c) [if c==NULL then emp else c|->] { c = NULL; } put(x) [x|->] { with buf when (c==NULL) { c = x; } } [emp] get(y;) [emp] { with buf when (c!=NULL) { y = c; c = NULL; } } [y|->] putter() { local x; alloc(x;); put(x); } getter() { local y; get(y;); /* use y */ dealloc(y); } main() { putter() || getter(); }