[armedbear-devel] Better Java interop

Tonight I committed two changes that will hopefully enhance Java interoperability on ABCL: 1) extensible classpath: two new primitives, java:add-to-classpath and java:dump-classpath, allow respectively to add a path/URL (or a list of them) to the classpath at runtime, and to inspect the classpath for debugging purposes. 2) proxying more than one interface: jmake-proxy now can also accept a list of interfaces to implement in Lisp. I also plan to add some other features, but I'd like to hear feedback about them first: 1) generified <T> T LispObject.javaInstance(Class<T>) to typecheck and avoid casts in user code converting Lisp objects to Java objects. 2) a configurable lists of Java packages to search for classes, so that users might write non-fully-qualified class names, e.g. (jclass "String"). 3) JSS-like syntax for easy method invocation (#methodName args), disabled by default 4) capability of jmethod, jfield, jconstructor to access private members (setAccessible(true)) depending on a special variable (or a function parameter). This was proposed by someone else some time ago but never implemented. Bye, Alessio

Had to patch as attached to get this to compile. -- "A screaming comes across the sky. It has happened before, but there is nothing to compare to it now."

On Jul 2, 2010, at 11:12 AM, Alessio Stalla wrote:
On Fri, Jul 2, 2010 at 11:03 AM, Mark Evenson <evenson@panix.com> wrote:
Had to patch as attached to get this to compile.
Ok, sorry. That was left over from my incomplete attempt to generify javaInstance(Class).
Committed as [svn r12775][1]. [1]: http://trac.common-lisp.net/armedbear/changeset/12775 -- "A screaming comes across the sky. It has happened before, but there is nothing to compare to it now."

On Thu, Jul 1, 2010 at 5:32 PM, Alessio Stalla <alessiostalla@gmail.com> wrote:
Tonight I committed two changes that will hopefully enhance Java interoperability on ABCL:
:)
1) extensible classpath: two new primitives, java:add-to-classpath and java:dump-classpath, allow respectively to add a path/URL (or a list of them) to the classpath at runtime, and to inspect the classpath for debugging purposes.
2) proxying more than one interface: jmake-proxy now can also accept a list of interfaces to implement in Lisp.
I also plan to add some other features, but I'd like to hear feedback about them first:
1) generified <T> T LispObject.javaInstance(Class<T>) to typecheck and avoid casts in user code converting Lisp objects to Java objects.
2) a configurable lists of Java packages to search for classes, so that users might write non-fully-qualified class names, e.g. (jclass "String").
3) JSS-like syntax for easy method invocation (#methodName args), disabled by default
Any reason not to use the same syntax: #".." - will make it much easier to migrate. Also note that in JSS #0"foo" returns the result of the call without casting to lisp object - e.g. (#"toString" ...) will return a java instance rather than a lisp string.
4) capability of jmethod, jfield, jconstructor to access private members (setAccessible(true)) depending on a special variable (or a function parameter). This was proposed by someone else some time ago but never implemented.
Bye, Alessio
_______________________________________________ armedbear-devel mailing list armedbear-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel

On Fri, Jul 2, 2010 at 4:28 PM, Alan Ruttenberg <alanruttenberg@gmail.com> wrote:
Any reason not to use the same syntax: #".." - will make it much easier to migrate. Also note that in JSS #0"foo" returns the result of the call without casting to lisp object - e.g. (#"toString" ...) will return a java instance rather than a lisp string.
No reason, I mean to use the exact same syntax, I just remembered it wrong. A.
participants (3)
-
Alan Ruttenberg
-
Alessio Stalla
-
Mark Evenson