Common Lisp Object System
The Common Lisp Object System (CLOS) is the facility for object-oriented programming in ANSI Common Lisp.[src] CLOS is a dynamic object system which differs radically from the OOP facilities found in more static languages such as C++ or Java.[src] CLOS was inspired by earlier Lisp object systems such as MIT Flavors and CommonLoops, although it is more general than either.[src] Originally proposed as an add-on, CLOS was adopted as part of the ANSI standard for Common Lisp and has been adapted into other Lisp dialects such as EuLisp or Emacs Lisp.[src]
The Common Lisp Object System (CLOS) is the facility for object-oriented programming in ANSI Common Lisp.[src] CLOS is a dynamic object system which differs radically from the OOP facilities found in more static languages such as C++ or Java.[src] CLOS was inspired by earlier Lisp object systems such as MIT Flavors and CommonLoops, although it is more general than either.[src] Originally proposed as an add-on, CLOS was adopted as part of the ANSI standard for Common Lisp and has been adapted into other Lisp dialects such as EuLisp or Emacs Lisp.[src] Declare the common argument structure prototype.[src] (defgeneric f (x y)) Define an implementation for (f integer y), where y matches all types.[src] (defmethod f ((x integer) y) 1) (f 1 2.0) => 1 Define an implementation for (f integer real).[src] (defmethod f ((x integer) (y real)) 2) (f 1 2.0) => 2 ; Dispatch changed at runtime.[src] Like the OO systems in most dynamic languages, CLOS does not enforce encapsulation.[src] Any slot can be accessed using the slot-value function or via (optionally auto-generated) accessor methods.[src] To access it via slot-value you have to know the name of the slot.[src] CL programmers use the language's package facility to declare which functions or data structures are intended for export.[src] Apart from normal ("primary") methods, there also are :before , :after , and :around "auxiliary" methods.[src] The former two are invoked prior to, or after the primary method, in a particular order based on the class hierarchy.[src] An :around method can control whether the primary method is executed at all.[src] Additionally, the programmer can specify whether all possible primary methods along the class hierarchy should be called or just the one providing the closest match.[src] The Standard Method-Combination provides the primary, before, after and around methods explained above.[src] There are other Method-Combinations with other method types.[src] New (both simple and complex) Method-Combinations and method types can be defined.[src] CLOS allows multiple inheritance.[src] When the default order in which methods are executed in multiple inheritance is not correct, the programmer may resolve the diamond inheritance problems by specifying the order of method combinations.[src] CLOS is dynamic, meaning that not only the contents, but also the structure of its objects can be modified at runtime.[src] CLOS supports changing class definitions on-the-fly (even when instances of the class in question already exist) as well as changing the class membership of a given instance through the change-class operator.[src] CLOS also allows one to add, redefine and remove methods at runtime.[src] The Circle-Ellipse Problem is readily solved in CLOS, and most OOP design patterns either disappear or are qualitatively simpler.[src] CLOS is not a prototype language: classes must be defined before objects can be instantiated as members of that class.[src]
30 sentences · 30 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"Common Lisp Object System." encyclopegia.org, 2026, https://encyclopegia.org/wiki/common-lisp-object-system. Accessed 05 December 2026.
Chicago
"Common Lisp Object System." encyclopegia.org. Accessed December 5, 2026. https://encyclopegia.org/wiki/common-lisp-object-system.
APA
encyclopegia.org. (2026). Common Lisp Object System. Retrieved December 5, 2026, from https://encyclopegia.org/wiki/common-lisp-object-system
Accessed December 5, 2026 · CC BY-SA 4.0 · citation page · JSON