On Sat, Feb 16, 2013 at 2:32 PM, Blake McBride <
blake@arahant.com> wrote:
> I have an idea for a largely seamless integration method for ABCL with Java
> that involves changing the ABCL REPL. It would work as follows.
>
> 1. From within Java or lisp, have the ability to register any number of
> Java classes with ABCL.
>
> 2. When executing lisp code of the form (fun args ...), try running the
> code as regular lisp code as it does now, but if it fails to find the lisp
> function and has at least one argument then:
>
> 3. Examine the arguments and, through reflection, try to find a Java method
> (with the same name as the lisp function) in one of the registered Java
> classes that matches the number and types of arguments and execute that.
> So, it would auto translate (in effect):
>
> (fun arg1 arg2 arg3 ...)
>
> into Java
>
> arg1.fun(arg2, arg3, ...);
>
> 4. There must be better auto-translation of lisp <-> java data types to
> include arrays and lists in order for this to work. So, in other words,
> when executing a lisp function passing a lisp array as one of the arguments,
> the Java reflection query will see a Java array argument type. It will also
> be auto-converted when making the call.
>
> 5. There must be some sort of cacheing mechanism to avoid redundant Java
> reflection calls.
>
> 6. This mechanism must take into account and correctly handle similar Java
> method names with different number and types of arguments both within and
> across different classes. It must also handle the fact that methods may be
> declared in Java superclasses.
>
> 7. This functionality can be enabled or disabled through some (Java and/or
> lisp function). Off by default to avoid troubles.
>
> Adding this functionality would make ABCL a plugin-and-go extension to Java.
> Any code could be written in Java or lisp immediately without complicated
> and cumbersome interface/translation code in most cases. There would be no
> huge initial hill to climb (to create all the interface code), and the usage
> would be natural and uncomplicated.
>
> Thanks.