> From: Taylor R Campbell <[email protected]>
> Date: Fri, 17 May 2013 03:13:38 +0000
>
> [...]
>
> Scheme48 has a working implementation of this. When C calls into
> Scheme, it passes Scheme a token and a return-to-c continuation to
> which Scheme must return the token. [...]
That would be cool. I have often pondered such a scheme, but I would
be anxious to get out of C space and into Scheme. Thus I would
re-apportion the work thusly:
C calls into Scheme (as usual). The Scheme callback-handler notes
the new state of the C stack, applies the chosen handler (with
optional thread switching), waits until the C stack has returned
to the noted state (if necessary), and returns.
There is a little less back-and-forth like "C calls back into Scheme
again saying `nope...'" And I'm not sure what you mean by "[C] passes
Scheme [...] a return-to-c continuation". It sounds like the point
between "applies the handler" and "waits until..." -- a continuation
in callback-handler.
I think a slightly more sophisticated callback-handler is all you
need. Why write *any* more C code? :-)
_______________________________________________
MIT-Scheme-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/mit-scheme-devel