Hurray! They accepted our paper "Featherweight Wrap Java" at SAC (The 22nd Annual ACM Symposium on Applied Computing), Special Track on Object-Oriented Programming Languages and Systems (OOPS), it will then appear on the proceedings of the conference (published by ACM press):
Lorenzo Bettini, Sara Capecchi, Elena Giachino.
Proc. of SAC (The 22nd Annual ACM Symposium on Applied Computing), Special Track on Object-Oriented Programming Languages and Systems (OOPS). ACM Press. 2007. To appear. abstract wrapjava.pdf bibtex
Abstract
We present an extension for a Java like language with a mechanism
for dynamically extending object behaviors. Our approach consists
in moving the addition of new features from class (static) level
to object (dynamic) level: the basic features of entities (representing
their structure) are separated from the additional ones (wrapper
classes whose instances represent run-time added behaviors). At
run-time, these entities can be dynamically composed by instantiating
wrapper objects which are attached to basic entities. We
formalize our extension by adding the new constructs to Featherweight
Java; the core language so extended (Featherweight Wrap
Java) is type safe.
Hopefully, this will become a Java extension (in the shape of a preprocessor) in order to have this "delegation-like" feature. The basic idea is to be able to extend object behaviors (methods) dynamically by wrapping objects. This reminds the Decorator pattern, and indeed this pattern was our main inspiration. (See the image representing the Decorator class diagram).
This way, you won't have to implement the pattern manually: you will simply use our proposed language extension.
Actually the language extension we propose is more powerful than what you get with decorator patterns, since it implements both consultation mechanisms and delegation mechanisms.
The theory of this extension is based on Featherweight Java.