Quaject
From Wikipedia, the free encyclopedia
In object-oriented programming, an object is a structure that holds variables that define its state; operations, or methods, are then written to manipulate this data.
In contrast, a quaject is a type of object that keeps a copy of its methods as part of its data load. The methods exist verbatim in the space of the object.
Because all the methods of an object are copied into it upon creation, a single pointer is enough to designate both the object and the desired method of that object to call. As the state of a quaject changes, it replaces the implementations of its methods with appropriate special cases. Alternatively, instead of supplying a callback function, the source quaject may simply install a copy of one of its methods into the callback slot of another quaject.
Quajects were first introduced by Henry Massalin in his PhD thesis describing a Unix-like kernel called Synthesis, written in the Motorola 68030 assembly language.
While no modern language uses the term quaject to describe its objects, many toy languages and scripting languages have quaject-like semantics, in which each object or actor carries with it scripts for all the actions it can perform. For one example, see Linden Scripting Language.