Meta-object
   HOME

TheInfoList



OR:

In
computer science Computer science is the study of computation, information, and automation. Computer science spans Theoretical computer science, theoretical disciplines (such as algorithms, theory of computation, and information theory) to Applied science, ...
, a metaobject is an
object Object may refer to: General meanings * Object (philosophy), a thing, being, or concept ** Object (abstract), an object which does not exist at any particular time or place ** Physical object, an identifiable collection of matter * Goal, an a ...
that manipulates, creates, describes, or implements objects (including itself). The object that the metaobject pertains to is called the base object. Some information that a metaobject might define includes the base object's
type Type may refer to: Science and technology Computing * Typing, producing text via a keyboard, typewriter, etc. * Data type, collection of values used for computations. * File type * TYPE (DOS command), a command to display contents of a file. * ...
,
interface Interface or interfacing may refer to: Academic journals * ''Interface'' (journal), by the Electrochemical Society * '' Interface, Journal of Applied Linguistics'', now merged with ''ITL International Journal of Applied Linguistics'' * '' Inter ...
,
class Class, Classes, or The Class may refer to: Common uses not otherwise categorized * Class (biology), a taxonomic rank * Class (knowledge representation), a collection of individuals or objects * Class (philosophy), an analytical concept used d ...
,
method Method (, methodos, from μετά/meta "in pursuit or quest of" + ὁδός/hodos "a method, system; a way or manner" of doing, saying, etc.), literally means a pursuit of knowledge, investigation, mode of prosecuting such inquiry, or system. In re ...
s,
attributes Attribute may refer to: * Attribute (philosophy), a characteristic of an object * Attribute (research), a quality of an object * Grammatical modifier In linguistics, a modifier is an optional element in phrase structure or clause structure whic ...
,
parse tree A parse tree or parsing tree (also known as a derivation tree or concrete syntax tree) is an ordered, rooted tree that represents the syntactic structure of a string according to some context-free grammar. The term ''parse tree'' itself is use ...
, etc. Metaobjects are examples of the computer science concept of
reflection Reflection or reflexion may refer to: Science and technology * Reflection (physics), a common wave phenomenon ** Specular reflection, mirror-like reflection of waves from a surface *** Mirror image, a reflection in a mirror or in water ** Diffuse r ...
, where a system has access (usually at run time) to its own internal structure. Reflection enables a system to essentially rewrite itself on the fly, to alter its own implementation as it executes.


Metaobject protocol

A metaobject protocol (MOP) provides the vocabulary (
protocol Protocol may refer to: Sociology and politics * Protocol (politics) Protocol originally (in Late Middle English, c. 15th century) meant the minutes or logbook taken at a meeting, upon which an agreement was based. The term now commonly refers to ...
) to access and manipulate the structure and behaviour of systems of objects. Typical functions of a metaobject protocol include: *Create or delete a new class *Create a new property or method *Cause a class to inherit from a different class ("change the class structure") *Generate or change the code defining the methods of a class Metaobject protocol is contrary to
Bertrand Meyer Bertrand Meyer (; ; born 21 November 1950) is a French academic, author, and consultant in the field of computer languages. He created the Eiffel programming language and the concept of design by contract. Education and academic career Meyer ...
's open/closed principle, which holds that software object systems should be ''open for extension'' but ''closed for modification''. This principle effectively draws a distinction between ''extending'' an object by adding to it, and ''modifying'' an object by redefining it, proposing that the former is a desirable quality ("''objects should be extensible to meet the requirements of future use cases''"), while the latter is undesirable ("''objects should provide a stable interface not subject to summary revision''"). Metaobject protocol, by contrast, transparently exposes the internal composition of objects and the entire object system in terms of the system itself. In practice, this means that programmers may use objects to redefine themselves, possibly in quite complex ways. Furthermore, metaobject protocol is not merely an
interface Interface or interfacing may refer to: Academic journals * ''Interface'' (journal), by the Electrochemical Society * '' Interface, Journal of Applied Linguistics'', now merged with ''ITL International Journal of Applied Linguistics'' * '' Inter ...
to an "underlying" implementation; rather, through metaobject protocol the object system is recursively implemented in terms of a ''meta''-object system, which itself is theoretically implemented in terms of a ''meta''-metaobject system, and so on until an arbitrary base case (a consistent
state State most commonly refers to: * State (polity), a centralized political organization that regulates law and society within a territory **Sovereign state, a sovereign polity in international law, commonly referred to as a country **Nation state, a ...
of the object system) is determined, with the protocol as such being the recursive functional relationship between these implementation levels. Implementing object systems in such a way opens the possibility for radical discretionary redesign, providing deep flexibility but introducing possibly complex or difficult-to-understand metastability issues (for instance, the object system must not destructively update its own metaobject protocol - its internal self-representation - but the potential destructiveness of some updates is non-trivial to predict and may be hard to reason about), depending on the recursive depth to which the desired modifications are propagated.''The Art of the Metaobject Protocol'', Appendix C — Living with Circularity For this reason, metaobject protocol, when present in a language, is usually used sparingly and for specialised purposes such as software that transforms other software or itself in sophisticated ways, for example in reverse engineering.


Runtime and compile time

When compilation is not available at run-time there are additional complications for the implementation of metaobject protocol. For example, it is possible to change the type hierarchy with such a protocol but doing so may cause problems for code compiled with an alternative class model definition. Some environments have found innovative solutions for this, e.g., by handling metaobject issues at compile time. A good example of this is OpenC++. The
Semantic Web The Semantic Web, sometimes known as Web 3.0, is an extension of the World Wide Web through standards set by the World Wide Web Consortium (W3C). The goal of the Semantic Web is to make Internet data machine-readable. To enable the encoding o ...
object-oriented model is more dynamic than most standard object systems, and is consistent with runtime metaobject protocols. For example, in the Semantic Web model classes are expected to change their relations to each other and there is a special
inference engine In the field of artificial intelligence, an inference engine is a software component of an intelligent system that applies logical rules to the knowledge base to deduce new information. The first inference engines were components of expert systems ...
known as a classifier that can validate and analyze evolving class models.


Usage

The first metaobject protocol was in the
Smalltalk Smalltalk is a purely object oriented programming language (OOP) that was originally created in the 1970s for educational use, specifically for constructionist learning, but later found use in business. It was created at Xerox PARC by Learni ...
object-oriented programming language developed at
Xerox PARC Future Concepts division (formerly Palo Alto Research Center, PARC and Xerox PARC) is a research and development company in Palo Alto, California. It was founded in 1969 by Jacob E. "Jack" Goldman, chief scientist of Xerox Corporation, as a div ...
. The
Common Lisp Object System The Common Lisp Object System (CLOS) is the facility for object-oriented programming in American National Standards Institute, ANSI Common Lisp. CLOS is a powerful dynamic programming language, dynamic object system which differs radically from t ...
(CLOS) came later and was influenced by the Smalltalk protocol as well as by Brian C. Smith's original studies on 3-Lisp as an infinite tower of evaluators. The CLOS model, unlike the Smalltalk model, allows a class to have more than one superclass; this raises additional complexity in issues such as resolving the lineage of the class hierarchy on some object instance. CLOS also allows for dynamic multimethod dispatch, which is handled via
generic functions In computer programming, a generic function is a function defined for polymorphism. In statically typed languages In statically typed languages (such as C++ and Java), the term ''generic functions'' refers to a mechanism for ''compile-time p ...
rather than
message passing In computer science, message passing is a technique for invoking behavior (i.e., running a program) on a computer. The invoking program sends a message to a process (which may be an actor or object) and relies on that process and its supporting ...
like in Smalltalk's
single dispatch In computer science, dynamic dispatch is the process of selecting which implementation of a polymorphic operation (method or function) to call at run time. It is commonly employed in, and considered a prime characteristic of, object-oriented ...
. The most influential book describing the semantics and implementation of the metaobject protocol in Common Lisp is ''
The Art of the Metaobject Protocol ''The Art of the Metaobject Protocol'' (AMOP) is a 1991 book by Gregor Kiczales, Jim des Rivieres, and Daniel G. Bobrow (all three working for PARC (company), Xerox PARC) on the subject of metaobject protocol. Overview The book contains an explana ...
'' by
Gregor Kiczales Gregor Kiczales is an American Canadians, American Canadian computer scientist. He is currently a professor of computer science at the University of British Columbia in Vancouver, British Columbia, Canada. He is best known for developing the conce ...
et al. Metaobject protocols are also extensively used in software engineering applications. In virtually all commercial CASE, re-engineering, and Integrated Development Environments there is some form of metaobject protocol to represent and manipulate the design artifacts. A metaobject protocol is one way to implement
aspect-oriented programming In computing, aspect-oriented programming (AOP) is a programming paradigm that aims to increase modularity by allowing the separation of cross-cutting concerns. It does so by adding behavior to existing code (an advice) ''without'' modifying t ...
. Many of the early founders of MOPs, including
Gregor Kiczales Gregor Kiczales is an American Canadians, American Canadian computer scientist. He is currently a professor of computer science at the University of British Columbia in Vancouver, British Columbia, Canada. He is best known for developing the conce ...
, have since moved on to be the primary advocates for aspect-oriented programming. Kiczales et al. of PARC were hired to design
AspectJ AspectJ is an aspect-oriented programming (AOP) extension for the Java programming language, created at PARC. It is available in Eclipse Foundation open-source projects, both stand-alone and integrated into Eclipse. AspectJ has become a widely ...
for
Java Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
, a language which does not possess a native metaobject protocol.


See also

*
Kind (type theory) In the area of mathematical logic and computer science known as type theory, a kind is the type of a type constructor or, less commonly, the type of a higher-order type operator ( type constructor). A kind system is essentially a simply typed lamb ...
*
Metaclass In object-oriented programming, a metaclass is a Class (computer science), class whose Instance (computer programming), instances are classes themselves. Unlike ordinary classes, which define the behaviors of objects, metaclasses specify the beha ...
*Javassist * Joose JavaScript meta object system * Moose Perl meta object system * OpenJava *
Unified Modeling Language The Unified Modeling Language (UML) is a general-purpose visual modeling language that is intended to provide a standard way to visualize the design of a system. UML provides a standard notation for many types of diagrams which can be roughly ...
: UML *
Groovy ''Groovy'' (or, less commonly, ''groovie'' or ''groovey'') is a slang colloquialism popular during the 1960s and 1970s. It is roughly synonymous with words such as "excellent", "fashionable", or "amazing", depending on context. History The word ...


References


External links


The Guile MOP specification (GOOPS, based on Tiny CLOS)



Common Lisp Object System Metaobject Protocol
(contains two chapters from ''The Art of the Metaobject Protocol'')

{{Data types Object (computer science)