Re: [ANN] jfli - a Java FLI for LispWorks
From: Andras Simon (andras_at_hexagon.renyi.hu)
Date: 07/12/04
- Next message: Paul Rubin: "Re: lisp is winner in DOM parsing contest! 8-]"
- Previous message: Mark Carter: "Re: Lisp: not so bad"
- In reply to: Rich Hickey: "[ANN] jfli - a Java FLI for LispWorks"
- Next in thread: Edi Weitz: "Re: [ANN] jfli - a Java FLI for LispWorks"
- Reply: Edi Weitz: "Re: [ANN] jfli - a Java FLI for LispWorks"
- Reply: Rich Hickey: "Re: [ANN] jfli - a Java FLI for LispWorks"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 12 Jul 2004 20:35:14 +0200
Rich Hickey <jfliNOO@SPPAMMrichhickey.com> writes:
> A beta of jfli, an open-source Java Foreign Language Interface for
> LispWorks, is now available:
>
> http://jfli.sourceforge.net
This is very, very cool stuff!
Just two comments for now.
1. I have applied all the advice given on the LW mailing list, but still, at the
point where jni-create-java-vm is called, LW dies with segmentation violation.
Has anyone been able to run it on Linux?
2. How do you plan to go about subclassing Java classes? My experience is that
in using Java libraries, the ability to create instances of Java classes and
call Java methods is not enough. Maybe there is a way around this (other than
writing those subclasses in Java) that I'm not aware of.
I struggled with this problem in ABCL, and ended up writing a class generator,
which produces classes whose methods call Lisp functions. Here's an example
from http://wwww.math.bme.hu/~asimon/lisp/swt.cl (slightly modified):
(java:jnew-runtime-class
"FileTreeLabelProvider" ;class name
"org.eclipse.jface.viewers.LabelProvider" ;super
'() ;no constructors
;methods
`(("getText" "java.lang.String" ("java.lang.Object")
,#'(lambda (element this)
(jcall-raw (jmethod "java.io.File" "getName") element))
"public")
("getImage" "org.eclipse.swt.graphics.Image" ("java.lang.Object")
,#'(lambda (element this)
(if (jcall (jmethod "java.io.File" "isDirectory") element)
(java-instance (get-1 (get-image-registry) "folder"))
(java-instance (get-1 (get-image-registry) "file"))))
"public"))
'() ;no fields
)
(For those who actually want to run this swt demo, all the necessary
ingredients are in http://wwww.math.bme.hu/~asimon/lisp/swt-example.tar.)
This has some weak points, the most prominent of which is that the Lisp
function gets Java objects as arguments, even though I can (and do) generate
clos wrappers for interesting Java classes (much as you do with
def-java-class). That's why I have to do (jcall (jmethod "java.io.File"
"isDirectory") element) instead of (is-directory-1 element) above.
But this is just an illustration of what kind of thing I'd like to see in
jfli.
Andras
- Next message: Paul Rubin: "Re: lisp is winner in DOM parsing contest! 8-]"
- Previous message: Mark Carter: "Re: Lisp: not so bad"
- In reply to: Rich Hickey: "[ANN] jfli - a Java FLI for LispWorks"
- Next in thread: Edi Weitz: "Re: [ANN] jfli - a Java FLI for LispWorks"
- Reply: Edi Weitz: "Re: [ANN] jfli - a Java FLI for LispWorks"
- Reply: Rich Hickey: "Re: [ANN] jfli - a Java FLI for LispWorks"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|