Jeremy Smith <[EMAIL PROTECTED]> writes:

> Initialising Python was easy in CFFI, and so was running strings of
> text. The problem was passing data back and forth between Python and
> Lisp. Luckily I've used the embedded Python API before, and I knew
> that you can pass an array of callback functions to Python, which
> call a Python DLL function to get their arguments, and can even
> return a value to Python afterwards (using another DLL
> function). These callbacks are called from within Python as a
> virtual module, prefixed by the module name (eg "Lisp").

I've been thinking about doing something like this as well (although
looking at other embeddable non-Lisp languages like Ruby and
Javascript too), as I have a need at work for allowing non-Lisp
programmers to write extensions to a large CL program in a language
they are familiar with.

It should be possible to make fancy use of CFFI type translators to
automatically convert Lisp values to and from Python when calling and
returning.  I also want to be able to define Python classes and
functions in Lisp---more of a Python bridge, I suppose.  In my case, I
would also need to be able to initialize multiple Python runtime
contexts in different threads---I'm not sure if Python can do
that(?)...

I started down this road with the Mozilla Javascript interpreter a few
weeks ago but got irritated when I realized how much of the public
interface was defined in terms of C macros (same problem with Ruby
IIRC).

James

_______________________________________________
Gardeners mailing list
[email protected]
http://www.lispniks.com/mailman/listinfo/gardeners

Reply via email to