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.<div><br></div><div>1. From within Java or lisp, have the ability to register any number of Java classes with ABCL.</div>
<div><br></div><div>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:</div><div>
<br></div><div>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):</div>
<div><br></div><div> (fun arg1 arg2 arg3 ...) </div><div><br></div><div>into Java </div><div><br></div><div> arg1.fun(arg2, arg3, ...);</div><div><br></div><div>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.</div>
<div><br></div><div>5. There must be some sort of cacheing mechanism to avoid redundant Java reflection calls.</div><div><br></div><div>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.</div>
<div><div><br></div><div>7. This functionality can be enabled or disabled through some (Java and/or lisp function). Off by default to avoid troubles.</div><div><br></div></div><div>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.</div>
<div><br></div><div>Thanks.</div><div><br></div><div>Blake McBride</div><div><br></div>