View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide

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


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, ...).

Implementation

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)

[Paper PDF]
[Slides PDF]
Noury Bouraqadi, Djamel Seriai, Gabriel Leblanc
ESUG 2005 Research Conference
Brussels, Belgium.

Mixins, Metaclasses and Compatibility (August 2003)

[PDF 974 KB]
Noury Bouraqadi
Slides of a talk given at the ESUG 2003 Conference at Bled, Slovenia.

MetaclassTalk Implementation and Metaclass Composition (June 2003)

[PDF 1.1MB]
Noury Bouraqadi
Slides of a talk given at the University of Berne, Switzerland.

AOP using Reflection in Smalltalk - The MetaclassTalk Experiment (June 2003)

[PDF 975KB]
Noury Bouraqadi
Slides of a talk given at the VUB, Belgium.

Reflection in OO Languages (January 2003)

In french!
[PDF 420KB]
Noury Bouraqadi
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)

[PDF 287KB]
Noury Bouraqadi
Slides of a talk given at ESUG 2002 Smalltalk Conference
Douai, France.

Benchmarks for MetaclassTalk 0.3 alpha (July 2002)

[PDF 139KB, PS 132KB]
Noury Bouraqadi.
Technical Report 2002-7-2.
Ecole des Mines de Douai, France.

Concern Oriented Programming using Reflection (October 2000)

[PS 40KB]
Noury Bouraqadi
OOPSLA 2000: Workshop on Advanced Separation of Concerns

Towards Transparent Strong Mobility Using a Reflective Smalltalk (August 2000)

[PDF 5.9MB]
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)

In French.
[PS 495KB]
Noury Bouraqadi
PhD thesis, University of Nantes, France.

Download