[racket] Racket embedding
On Thu, 12 Dec 2013, Thomas Chust wrote:
> On 2013-12-12 17:53, Jan Wedekind wrote:
>> [...]
>> However when doing embedding there is no single 'run' method to
>> pass to 'scheme_main_setup'. Is there another simple way to do that?
>> [...]
>
> Hello,
>
> it is probably a bad idea to use any setup that doesn't have a single
> "run" method! If you reenter the interpreter with a different stack
> setup, things like continuations from a previous run could easily break.
>
> Since each Racket interpreter is also single-threaded, it's probably
> best to employ a dedicated evaluation thread that does have a single run
> method and services requests coming in through some queuing mechanism.
>
> This will also allow you to keep Racket background threads running in
> the background rather than blocking all Racket threads between calls
> into your Racket binding.
>
> Simply spawning Racket in a subprocess rather than embedding the
> interpreter may also be an option, although the marshalling overhead for
> in-process inter-thread communication may be somewhat lower than for
> inter-process communication.
>
> Ciao,
> Thomas
Hmm. Thanks for your response. I managed to get some kind of integration
working (code lifted from from Schemepy) with Python and Guile [1] in case it
helps somebody else.
[1] https://gist.github.com/wedesoft/7991129