Hello,
on Saturday, August 1, 2009, 1:18:53 AM Tobias wrote:
Long term: [...] * Make it possible to extend Java classes from Lisp. * Make it possible to implement Java interfaces from Lisp.
It is possible already, with JAVA:JNEW-RUNTIME-CLASS, although maybe the form isn't really convenient.
To have JAVA:JNEW-RUNTIME-CLASS in ABCL it is necessary to compile org/armedbear/lisp/runtime-class.lisp. It requires asm.jar [1] to be in classpath, and therefore, as far as I understand, is excluded from compilation by default (see <exclude name="org/armedbear/lisp/runtime-class.lisp"/> in build.xml).
Another interesting source that may be useful to define convenient java interop is port of Rich Hickey's Jfli [2] to ABCL. I found the ABCL version created by asimon@math.bme.hu here: http://www.math.bme.hu/~asimon/lisp/jfli-abcl.tar.
jfli-abcl provides a macro (experimental) NEW-CLASS macro for creation java classes in Lisp (including inheritance from existing classes/interfaces). NEW-CLASS is a wrapper around JAVA:JNEW-RUNTIME-CLASS. Some examples of it's usage are also provided.
I'd say NEW-CLASS macro isn't perfect from usability point of view, but may probably be used as a starting point for something better.
- integrate Java's object hierarchy into the CLOS object hierarchy. I'm not a CLOS expert, but a few people come to mind who to ask.
Jfli approaches this problem: http://jfli.sourceforge.net/#wrappergen
I am using these tools now to create a plugin for for Intellij IDEA (nothing serious, more like a hello world). Maybe I'll post it as an example to the list soon.
In the attach is the jfli-abcl.lisp I use. It fixes small error in the NEW-CLASS (one backqoute :). And adds a kind of extension/fix: constructors for NEW-CLASS created classes may accept not only jfli wrapped java objects, but also native Lisp objects (which are java objects anyway in case of ABCL).
1. ASM java bytecode manipulation framework home is here: http://asm.ow2.org/ ABCL seems to use not the latest one, but elder 1.5.3 version: http://forge.ow2.org/project/download.php?group_id=23&file_id=3084
2. http://jfli.sourceforge.net/
Best regards, - Anton