MetaclassTalk: Reflection and Meta-Programming in Smalltalk
What is MetaclassTalk?
MetaclassTalk is a reflective extension of Smalltalk that provides programmers with a a meta-object protocol (MOP) to control objects structure (memory allocation and access to instance variables) and behavior (message sends and receptions and method lookup and application). It aims easing experiments of new concepts, programming pradigms and langage extensions.
MetaclassTak was first designed and developed by Noury Bouraqadi during his Ph.D. The first prototype was made on top of VisualWorks 2.0 an relied on NeoClasstalk . Then, during his master, Gabriel Casarini made a first port MetaclassTalk to Squeak 2.7. In 2001, Noury completly rewrote MetaclassTalk for Squeak 3.2. By now, Noury is still maintaning and evolving MetaclassTalk. He makes different experiments with it (AOP, Mixins, ...) and supervises Master and PhD students that make use of MetaclassTalk reflective facilities.
Some Projects Where MetaclassTalk is Used
- Reza Razavi uses MetaclassTalk for building a tool named Dyctalk dedicated to Adaptive Modeling.
- Rabih Nassrallah used MetaclassTalk for building a remote communication aspect for Web Services.
- Romain Robbes used MetaclassTalk for its Multi-Agent System.
- Alan Cyment uses MetaclassTalk in the SetPoint project to build a AOP (Aspect-Oriented Programming) prototype with new kinds of join-points.
What is Reflection?
Reflection is the ability of a system to reason and to act upon it self. Such a system includes its own interpreter (or at least part of it). So a reflective system can observe its own execution (that is introspection) and even change the way it runs (that is intercession). For example a reflective system is able to change the way it handles message sendings.
Reflection has many interesting uses. Easing the developpement of programming tools such as browsers and debuggers is certainly one among the most well known. Building such tools is eased since program entities such as classes and methods are reified, i.e. they exist at run-time as a full fledged objects. Another possible application of reflection is adapting the programming language to the application domaine. This adaptation can be an extension of the programming language (e.g. introducing multiple inheritance in a language with only single inheritance) or even changing the programming paradigm (e.g. allowing actor based programming in a language that support initially only class based programming). Reflection is also usefull for separating programs functionalities from non-functionnal concerns (or aspects) (e.g. distribution, concurrency, ...). Dynamic adaptability is another important property of reflective systems. Execution mecanismes of reflective systems can be evolved during run-time inorder to optimize the use of the available resources and to take into account evolutions than can happen randomly (e.g. machine load, network bandwidth reduction, ...).
The implementation of MetaclassTalk are based on the following technics:
The latest implementations aimed to be fully compatible with Squeak (i.e. no change of the VM or new primitives). Efficiency is another important issue. Hooks that allow jumping from base to the meta-level introduce an overhead. In order to minimize this overhead, one first solution is to introduce only required hooks. That is introducing hooks, only if the Smalltalk default interpretation process is extended.
Related Papers and Talks
Towards Unified Aspect-Oriented Programming (August 2005)
Noury Bouraqadi, Djamel Seriai, Gabriel Leblanc
ESUG 2005 Research Conference
Mixins, Metaclasses and Compatibility (August 2003)
[PDF 974 KB]
Slides of a talk given at the ESUG 2003 Conference at Bled, Slovenia.
MetaclassTalk Implementation and Metaclass Composition (June 2003)
Slides of a talk given at the University of Berne, Switzerland.
AOP using Reflection in Smalltalk - The MetaclassTalk Experiment (June 2003)
Slides of a talk given at the VUB, Belgium.
Reflection in OO Languages (January 2003)
Slides of a talk given at GREYC, University of Caen, France.
Aspect-Oriented Programming Using Refection (October 2002)
[PDF 229KB, PS 197KB]
Noury Bouraqadi and Thomas Ledoux.
Technical Report 2002-10-3.
Ecole des Mines de Douai, France.
MetaclassTalk: a Testbed for Exploring Programming Paradigms (August 2002)
Slides of a talk given at ESUG 2002 Smalltalk Conference
Benchmarks for MetaclassTalk 0.3 alpha (July 2002)
[PDF 139KB, PS 132KB]
Technical Report 2002-7-2.
Ecole des Mines de Douai, France.
Concern Oriented Programming using Reflection (October 2000)
OOPSLA 2000: Workshop on Advanced Separation of Concerns
Towards Transparent Strong Mobility Using a Reflective Smalltalk (August 2000)
Gabriel P. Casarini
Master Thesis, Vrije Universiteit Brussel (Belgium) In Collaboration with Ecole des Mines de Nantes (France).
A Smalltalk MOP for the Study of Metaclass Composition and Compatibility - Application to Aspect-Oriented Programming (July 1999)
PhD thesis, University of Nantes, France.
- Friday, april 28th, 2006: MetaclassTalk for Squeak 3.9 (still incomplete) is available on squeak source
- Thursday, september 8th, 2005: MetaclassTalk 0.4 for Squeak 3.2 with Unified AOP support and example
- Wednesday, april 30th, 2003: MetaclassTalk 0.3 beta for Squeak 3.2
- Thursday, january 9th, 2003 : MetaclassTalk 0.3 alpha 4 for Squeak 3.2
- Saturday, august 24th, 2002: MetaclassTalk 0.3 alpha 3 for Squeak 3.0
- Tuesday, july 16th, 2002: MetaclassTalk 0.3 alpha 2 for Squeak 3.0
- Tuesday, june 11th, 2002: MetaclassTalk 0.3 alpha 1 for Squeak 3.0
- Monday, January 22, 2001: MetaclassTalk-0.2Beta2.zip (75 K) for Squeak 2.7. Fix some major bugs and particulary allows recompilation of MetaclassTalk classes and the introduction of their changes into the change set.
- Monday, January 08, 2001: MetaclassTalk-0.2Beta1.zip (73 K) for Squeak 2.7. Full portability (Does not require a specific VM any more) + Two examples illustrate the use of the MOP.
- MetaclassTalk-0.1Beta.zip (72 K) for Squeak 2.7 Requires a specific VM made by Brent Pinkney which allows changing classes inorder to bootstrap the kernel. The link to Brent's VM web page seems not be alive anymore.