Metaclass

in programming languagesmeta-classesMetaclassesmetaobject classes
In object-oriented programming, a metaclass is a class whose instances are classes.wikipedia
59 Related Articles

Smalltalk

Smalltalk-72ObjectStudioSmalltalk programming language
In Smalltalk, everything is an object.
Smalltalk-80 added metaclasses, to help maintain the "everything is an object" (except private instance variables) paradigm by associating properties and behavior with individual classes, and even primitives such as integer and boolean values (for example, to support different ways to create instances).

First-class citizen

first-class objectfirst-classfirst class
Metaclasses can be implemented by having classes be first-class citizen, in which case a metaclass is simply an object that constructs classes.
In most languages, data types are not first-class objects, though in some object-oriented languages, classes are first-class objects and are instances of metaclasses.

Python (programming language)

PythonPython programming languagePython 2
In Python, the builtin class is a metaclass.
New instances of classes are constructed by calling the class (for example, or ), and the classes are instances of the metaclass (itself an instance of itself), allowing metaprogramming and reflection.

Class (computer programming)

classclassesPartial class
In object-oriented programming, a metaclass is a class whose instances are classes.
In these languages, a class that creates classes is called a metaclass.

XOTcl

Some less widespread languages that support metaclasses include OpenJava, OpenC++, OpenAda, CorbaScript, ObjVLisp, Object-Z, MODEL-K, XOTcl, and MELDC.
XOTcl is based on a dynamic object system with metaclasses which as influenced by CLOS.

Logtalk

Logtalk, an object-oriented extension of Prolog, also supports metaclasses.
As an object-oriented programming language, Logtalk's major features include support for both classes (with optional metaclasses) and prototypes, parametric objects, protocols (interfaces), categories (components, aspects, hot patching), multiple inheritance, public/protected/private inheritance, event-driven programming, high-level multi-threading programming, reflection, and automatic generation of documentation.

Common Lisp Object System

CLOSCLOS MOPCommon Lisp Object System (CLOS)
Classes can have multiple superclasses, a list of slots (member variables in C++/Java parlance) and a special metaclass.

Metaclass (Semantic Web)

Similar to their role in programming languages, metaclasses in Semantic Web languages can have properties otherwise applicable only to individuals, while retaining the same class's ability to be classified in a concept hierarchy.

Metaobject

metaobject protocolmeta-object protocolmetaobject protocols
Each language has its own metaobject protocol, a set of rules that govern how objects, classes, and metaclasses interact.

Object-oriented programming

object-orientedobject orientedobject-oriented programming language
In object-oriented programming, a metaclass is a class whose instances are classes.

Computer programming

programmingcodingprogrammable
In object-oriented programming, a metaclass is a class whose instances are classes.

Class-based programming

class-basedclass definedclass-based inheritance
Additionally, Smalltalk is a class based system, which means that every object has a class that defines the structure of that object (i.e. the instance variables the object has) and the messages an object understands.

Method (computer programming)

methodsmethodabstract method
Class methods actually belong to the metaclass, just as instance methods actually belong to the class.

Class variable

classstatic member variable
To allow classes to have their own methods and their own instance variables (called class instance variables and should not be confused with class variables), Smalltalk-80 introduced for each class their own metaclass.

Singleton pattern

singletonsingletonsSingleton object
This means that each metaclass is effectively a singleton class.

Conjoined twins

Siamese twinsconjoined twinconjoined
* Like conjoined twins, classes and metaclasses are born together.

Class browser

class browsingrefactoring browsers
Note that the usual Smalltalk class browser does not show metaclasses as separate classes.