On Wed, Feb 16, 2011 at 10:33 AM, Lukas Georgieff lukas.georgieff@hotmail.com wrote:
Hi, I am new to ABCL and have a question to it's capabilities: My goal is to load an exsting part of a system coded in lisp into Java and to use the lisp code as basic library for a java application. Currently my approach is to load the lisp code with: Interpreter interpreter = Interpreter.createInstance(); interpreter.eval("(load "my-lisp-code.lisp")"); ... So the lisp code must be present in the project every time it is running. Is there any chance to translate the lisp code to a Java source file by using ABCL? So it would not be necessary to provide the lisp code in the java application after it is translated once.
Hello Lukas,
ABCL does not translate Lisp source to Java source; you can compile your Lisp code to JVM bytecode, but you'll still have to load it with (load "my-compiled-code.abcl"), because only functions are compiled to classes, not top-level forms. You can provide a Java facade over the Lisp code/library, so that the API user is unaware of Lisp; but you'll have to do it yourself.
One improvement that we eventually want to implement (actually, to restore and improve) is the ability for ABCL to generate a Java class with methods implemented in Lisp (more or less what Clojure does with gen-class, if you know it). With that feature, you'll still have to bundle your Lisp code with the Java application, but the loading of your code could be handled by the generated class.
Keep in mind that you can bundle your Lisp code as resources inside the Jar of your application, so the end user won't see any extra files.
Kind regards, Alessio