> From: Paul Landes [...] > It isn't possible to duplicate the beanshell functionality in elisp. It has > to be in > Java or a Java scripting language since Java reflection is used for > templating/wizards etc.
After reading this the first time and balking at the phrase "it isn't possible", I wrote a couple of Java classes for my amusement, and I hope yours, too. (See below.) After reading this the second time, I realized that I missed your point. (If I hadn't missed the point, I would have tried to write elisp, not java.) Incidentally, conversation regarding ABCL in the other messages in this thread is in line with the idea that I intended to express in the proof of concept: that emacs can carry on a conversation with a (thin) process in a running JVM in order to get information that isn't readily available outside of a JVM. So, +1 for ABCL. (I've used it elsewhere and I like it. It seems to be maturing at a pretty good rate. Apparently MOP stuff works, and there's some maven-asdf bridge that I haven't tried yet.) Regarding whether or not to fork, I can't comment on that, other than that it certainly wasn't my intent when I asked for a list of TODO items. :) Cheers, --Dave >>>>>>>>> hobbes@metalbaby:~/workspace/poc-el-reflection$ find . . ./.classpath ./.project ./bin ./bin/gnu ./bin/gnu/emacs ./bin/gnu/emacs/ElispBridge.class ./bin/gnu/emacs/MyObject.class ./src ./src/gnu ./src/gnu/emacs ./src/gnu/emacs/ElispBridge.java ./src/gnu/emacs/MyObject.java hobbes@metalbaby:~/workspace/poc-el-reflection$ head -1000 src/*/*/* ==> src/gnu/emacs/ElispBridge.java <== package gnu.emacs; import java.lang.reflect.Method; public class ElispBridge { public static void main(String[] args) throws Exception { //TODO get these strings from stdin, or a socket, or SOAP, or whatever. //I don't know lisp, so pardon me if these strings are silly. String query1 = "('object-methods 'gnu.emacs.MyObject)"; String query2 = "('invoke-method 'gnu.emacs.MyObject 'getStuff)"; //TODO determine query type at runtime, instead of hardcoding it. // query1 is looking for a list myObject's methods. // query2 is looking for information about a method. //query1 ... //TODO extract object name from query more reliably. String className = chewSexp(query1)[2]; Class<?> cls = Class.forName(className); for (Method m : cls.getMethods()) { //TODO return data to elisp in more elegant way. System.out.println(m); } System.out.println("***\n\n"); // query2 ... String otherClassName = chewSexp(query2)[2]; String methodName = chewSexp(query2)[3]; Class<?> otherCls = Class.forName(otherClassName); Object instance = otherCls.newInstance(); System.out.println(otherCls.getMethod(methodName, null).invoke(instance, null)); //TODO POC the other dozens of things reflection can do. } private static String[] chewSexp(String sexp) { // TODO Use off the shelf sexp parser, something with stacks... return sexp.replaceAll("[()]","").split(" *'"); } } ==> src/gnu/emacs/MyObject.java <== package gnu.emacs; public class MyObject { public String getStuff(){ return "Hello, World!"; } public void doNothing(String s, Object o, char[] ca){}; } hobbes@metalbaby:~/workspace/poc-el-reflection$ cd bin; java gnu.emacs.ElispBridge public java.lang.String gnu.emacs.MyObject.getStuff() public void gnu.emacs.MyObject.doNothing(java.lang.String,java.lang.Object,char[]) public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException public final void java.lang.Object.wait() throws java.lang.InterruptedException public boolean java.lang.Object.equals(java.lang.Object) public java.lang.String java.lang.Object.toString() public native int java.lang.Object.hashCode() public final native java.lang.Class java.lang.Object.getClass() public final native void java.lang.Object.notify() public final native void java.lang.Object.notifyAll() *** Hello, World! hobbes@metalbaby:~/workspace/poc-el-reflection/bin$ >>>>>>>>> ------------------------------------------------------------------------------ Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET Get 100% visibility into your production application - at no cost. Code-level diagnostics for performance bottlenecks with <2% overhead Download for free and get started troubleshooting in minutes. http://p.sf.net/sfu/appdyn_d2d_ap1 _______________________________________________ jdee-devel mailing list jdee-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jdee-devel