Yes, but where is that continuation put? Python iterators have a place
to put it .. your syntax so far doesn't. To extend your example
your proposing something like:
retval, cont = callcc(f,1);
Yes that was what i was thinking when saying "$callcc will return the
yield'ed value AND the continuation of f". Since there is no multiple
return values in Neko, it would mean return an array of two elements.
In order to reduce memory footprint, it might be nice to let the user
pass a reference to callcc that will store the continuation :
var cont = $array(f);
retval = callcc(cont,1);
retval = callcc(cont,1);
...
I think also it's very difficult to have it work with the C stack. But
you can't simply ignore the C calls since it might break your
compile-time type contraints (think about a C "map" for example). Since
the VM knows that there was a C call it can turn the yield into a
runtime exception in the case a C call is found when saving the VM
stack. I think I'll go this way right now. Pure VM continuations are
already something interesting enough.
Nicolas
---
Neko : One VM to run them all