Implementing dynamic language features in Java using dynamic code generation
Thomas Michael Breuel
Abstract
Thomas Michael Breuel
Abstract
Compared to dynamic object-oriented languages like CommonLisp or Smalltalk, Java has a fairly simple and restrictive object and type system. Some of the key differences between Java and these other languages are that they offer structural conformance, automatic delegation and dynamic mix-ins. When such constructs are needed in a language like Java, they are usually expressed in terms of standard object-oriented design patterns, requiring the manual implementation of "glue" or "helper" classes. This paper describes ways in which such features can be provided efficiently and automatically in terms of Java's platform-independent binary format and dynamic loading mechanisms. The implementation does not require any changes to the Java runtime environment, byte-codes or class loader, and it yields a performance that is comparable to manually implemented design patterns. The approach should prove useful both as a programming tool for Java and as a strategy for building efficient implementations of dynamic languages on top of the Java Virtual Machine.
OpenAlex reports 10 citations for this work. Citation counts describe recorded attention and do not establish research quality.
A contribution statement is not available in the OpenAlex record.
Method details are not available in the OpenAlex metadata.
Findings are not separately available in the OpenAlex metadata.
Limitations are not available in the OpenAlex metadata.
Application details are not available in the OpenAlex metadata.
Compared to dynamic object-oriented languages like CommonLisp or Smalltalk, Java has a fairly simple and restrictive object and type system. Some of the key differences between Java and these other languages are that they offer structural conformance, automatic delegation and dynamic mix-ins. When such constructs are needed in a language like Java, they are usually expressed in terms of standard object-oriented design patterns, requiring the manual implementation of "glue" or "helper" classes. This paper describes ways in which such features can be provided efficiently and automatically in terms of Java's platform-independent binary format and dynamic loading mechanisms. The implementation does not require any changes to the Java runtime environment, byte-codes or class loader, and it yields a performance that is comparable to manually implemented design patterns. The approach should prove useful both as a programming tool for Java and as a strategy for building efficient implementations of dynamic languages on top of the Java Virtual Machine.
Key concepts: Computer science, Generics in Java, Java Modeling Language, Java, Programming language, Java annotation, strictfp, Real time Java