Metaprogramming and reflection were pioneered by the languages Lisp and Smalltalk. In Lisp all programs are treated as data. It is possible to inspect their structure and even to dynamically build new programs (higher order functions) that can be executed. In Smalltalk types are represented as classes and procedures as methods of these classes. The structure of a class is described in a metaclass of which the class is an instance. The metaclass information can again be accessed and even modified. Many other languages allow metaprogramming in a similar way as it is done in Lisp or Smalltalk (e.g., Self, CLOS, or Beta).
The original Oberon System offered only a limited degree of reflection. It provided a module Modules which allowed programmers - among other things - to inpect information about all loaded modules. Later a module Types was added which provided basic information about record types. However, Types was not documented in the books about Oberon. In his dissertation J. Templ implemented an experimental version of Oberon for Sun workstations which treated modules, procedures and record types as data allowing also full access to their components.
We implemented a module to provide access to run time data structures and some applications that make extensive use of it (e.g., a post-mortem debugger, a database interface (provides functionality simlar to Embedded SQL in Oberon, but without the need for preprocessing), a heap inspector and a general output module).
Sprache der Kurzfassung:
Notiz zur Publikation:
Christoph Steindl: Reflection in Oberon. Paper at the 6th ECOOP Workshop for PhD Students in Object-Oriented Programming, Linz, Austria, July 7-8, 1996