A Most Specific Method Finding Algorithm for Reflection Based Dynamic Prolog-to-Java Interfaces
- 223 Downloads
In the context of direct and reflection based extension mechanisms for the Jinni 2000 Java based Prolog system, we discuss the design and the implementation of a reflection based Prolog to Java interface. While the presence of dynamic type information on both the Prolog and the Java sides allows us to automate data conversion between method parameters, the presence of subtyping and method overloading makes finding the most specific method corresponding to a Prolog call pattern fairly difficult. We describe a run-time algorithm which closely mimics Java’s own compile-time method dispatching mechanism and provides accurate handling of overloaded methods beyond the reflection package’s limitations. As an application of our interfacing technique, a complete GUI library is built in Prolog using only 10 lines of application specific Java code.
KeywordsJava based Language Implementation Prolog to Java Interface Method Signatures Dynamic Types Method Overloading Most Specific Method Reflection
Unable to display preview. Download preview PDF.
- P. Bothner. Kawa, the Java based Scheme system. Technical report, 1999. Available from http://www.delorie.com/gnu/docs/kawa/kawa toc.html.
- J. Gosling, B. Joy, and G. Steele. The Java Language Specification, Second Edition. Java Series. Addison-Wesley, 1999. ISBN:0-201-31008-2.Google Scholar
- N. Kino. Plc. java: JIPL class source. Technical report, KLS Research Labs, 1997. Available from http://www.kprolog.com/jipl/index e.html.
- P. Tarau. A Logic Programming Based Software Architecture for Reactive Intelligent Mobile Agents. In P. Van Roy and P. Tarau, editors, Proceedings of DIPLCL’99, Las Cruces, NM, Nov. 1999. http://www.binnetcorp.com/wshops/ICLP99DistInetWshop.html.
- P. Tarau. Inference and Computation Mobility with Jinni. In K. Apt, V. Marek, and M. Truszczynski, editors, The Logic Programming Paradigm: a 25 Year Perspective, pages 33–48. Springer, 1999. ISBN 3-540-65463-1.Google Scholar
- P. Tarau. Intelligent Mobile Agent Programming at the Intersection of Java and Prolog. In Proceedings of The Fourth International Conference on The Practical Application of Intelligent Agents and Multi-Agents, pages 109–123, London, U.K., 1999.Google Scholar
- P. Tarau. Fluents: A Refactoring of Prolog for Uniform Reflection and Interoperation with External Objects. In J. Lloyd, editor, Proceedings of CL’2000, London, July 2000. to appear at Springer-Verlag.Google Scholar