o3: A Language With Unified Composition Mechanism


In today's object-oriented programming languages, abstraction units (such as classes, traits, aspects) are modified through various composition mechanisms; inheritance, parameter type binding and advice weaving (for aspects) are representative ones. However, those composition mechanisms are all the same in that they compose objects which implement desirable protocols. Having multiple composition mechanisms defeats design orthogonally of a language, and raises (miss-) selection problems. In this paper, we propose a programming language with a unified composition mechanism. In this mechanism, methods are individually copied and combined according to dedicated domain-specific language description executed at compile time, in a type-safe manner. In this language, type names and non-local variable names within a method are converted to parameters when the method was ``unplugged'' from its original context. Those parameters can be rebound to actual types and variables when the method is ``plugged'' to another context. This mechanism can be used to implement large part of existing composition mechanism listed above, and also some completely new ones.