On Mon, May 3, 2010 at 5:04 AM, Seth Burleigh <firstname.lastname@example.org>
(1) A C/C++ program wants to call a lisp function with its own data
These are called "callbacks". All foreign function interfaces for Lisp support them, including CFFI and ECL. However ECL currently gives them rather "obscure" names and does not export them.
(2) Intertwined development/tight integration: if an algorithm needs to
be implemented in c/c++ for efficiency, it is much more convenient to
define it in the lisp code than create another c/c++ file
CLINES allows you to embed arbitrary C/C++ code in the file. The only thing you will not get is that the code is produced in an order which is consistent with the execution of Common Lisp forms. In other words, if you insert a CLINES statement in a function it will be moved out of it to the beginning of the generated C file.
Of course, the code would also have to be able to call lisp functions
defined in the current package in order for this to be effective (or to
be able to call lisp functions which have been designated as
'callbackable', like in gambit-c scheme) [...]
(3) Programs built in c++ already have a class hierarchy. If you want to
create a subclass which the c++ program can use, you need to be able to
directly input toplevel code (i.e. define a class, methods, etc).
I insist that this is mostly used for headers, but it need not be.