LLMpediaThe first transparent, open encyclopedia generated by LLMs

CLOS

Generated by GPT-5-mini
Note: This article was automatically generated by a large language model (LLM) from purely parametric knowledge (no retrieval). It may contain inaccuracies or hallucinations. This encyclopedia is part of a research project currently under review.
Article Genealogy
Expansion Funnel Raw 30 → Dedup 0 → NER 0 → Enqueued 0
1. Extracted30
2. After dedup0 (None)
3. After NER0 ()
4. Enqueued0 ()
CLOS
NameCLOS
TypeProgramming language paradigm / library
First appeared1984
ParadigmMulti-paradigm: object-oriented, dynamic, reflective
DesignersGuy L. Steele Jr., Richard P. Gabriel, Kent M. Pitman, David A. Moon
ImplementationsGNU CLISP, SBCL, Allegro CL, Clozure CL, LispWorks
Influenced byCommon Lisp, Lisp, Flavors, Smalltalk
InfluencedDylan, Objective-C (concepts), Java (dynamic ideas)

CLOS CLOS is the Common Lisp Object System, a dynamic, multiple-dispatch object system standardized for ANSI Common Lisp and integrated into implementations such as SBCL, Allegro CL, Clozure CL, GNU CLISP, and LispWorks. It provides class definitions, generic functions, multiple inheritance, method combination, and a Metaobject Protocol that enables extensive runtime and compile-time customization. CLOS played a central role in the evolution of Common Lisp during the 1980s and 1990s and influenced object systems in languages like Dylan and Objective-C.

Overview

CLOS is a standardized object system specified as part of ANSI Common Lisp that supplies first-class objects, classes, and generic functions for dynamic dispatch across multiple arguments. It supports many features pioneered by systems such as Flavors and concepts from Smalltalk, while integrating with the broader Common Lisp language and its macro facility. Major architects include Guy L. Steele Jr., Richard P. Gabriel, Kent M. Pitman, and David A. Moon, whose design discussions intersected with institutions like Xerox PARC and companies such as Symbolics and LMI. CLOS emphasizes runtime reflection, method combination inspired by Flavors, and programmer control over inheritance and method resolution.

History and development

CLOS emerged from efforts in the early 1980s to unify disparate object-oriented extensions to Common Lisp found in commercial systems like Symbolics Genera and research projects at MIT, Xerox PARC, and University of Utah. Influential precursors included Flavors (from MIT AI Lab) and object frameworks from Stanford and CMU. Standardization work involved committees and contributors who met under the auspices of X3J13 during the development of ANSI Common Lisp, leading to the formal CLOS specification in the ANSI standard adopted in 1994. Subsequent work produced a formalized Metaobject Protocol through efforts by Steele, K. Pitman, and others, disseminated via venues like SIGPLAN conferences and publications in ACM proceedings. Commercial implementations from Franz Inc. (Allegro CL) and open-source projects such as SBCL spread CLOS adoption across industry and academia.

Core concepts and features

CLOS centers on a few core abstractions: classes, instances, generic functions, methods, and method combinations. Classes declared via defclass can specify slots, default initialization, and direct superclasses; instances are created with make-instance. Generic functions group methods that dispatch on argument types; methods are defined with defmethod and can specialize on class qualifiers. Multiple dispatch allows method selection based on runtime types of several arguments, distinct from single-dispatch systems like Objective-C; method combination permits strategies such as :around, :before, and :after to control invocation order. CLOS supports multiple inheritance with linearization rules, dynamic class redefinition with update-instance-for-redefined-class, and slot introspection through slot-value and accessors. The system integrates with Common Lisp macros and condition system for advanced metaprogramming and error handling.

Syntax and semantics

CLOS adopts Lisp s-expression syntax; class definitions use defclass, methods use defmethod, and generic functions can be declared with defgeneric. Semantically, class precedence lists determine inheritance resolution; method applicability and specificity rules define which methods combine to satisfy a generic function call. Slots have initargs, :initform, type declarations, and allocation keywords like :allocation :class or :instance; initialization protocols follow make-instance and initialize-instance. The semantics of method combination follow a protocol that determines the ordering and visibility of :before, :after, :around, and primary methods, enabling aspect-like behavior analogous to constructs in AspectJ-style discussions though predating them. CLOS also defines object identity and eql-specializers for fine-grained dispatch.

Metaobject Protocol

The CLOS Metaobject Protocol (MOP) exposes the introspection and modification of class and method behaviors as first-class objects: classes are instances of class metaobjects, generic functions have metaobjects, and method dispatch machinery can be customized by redefining meta-level operations. The MOP specification was articulated by authors including KMP (Kent M. Pitman) and was explored in publications and implementations influenced by research from Harvard University, MIT, and industrial labs. MOP enables programmers to create domain-specific inheritance rules, alternative slot storage strategies, and custom method combination—capabilities leveraged in frameworks from Symbolics and projects at Xerox PARC. The protocol facilitated experiments in reflective systems and influenced reflective capabilities in later languages like Dylan and research in Reflective Programming.

Implementations and extensions

Major commercial and open-source Common Lisp implementations include Allegro CL, LispWorks, Clozure CL, SBCL, and GNU CLISP, each providing CLOS with slight extensions or performance characteristics. Extensions and libraries build on CLOS for object-relational mapping, GUI toolkits (e.g., via bindings to GTK+), web frameworks, and persistent object stores. Academic projects and industrial users have extended CLOS with MOP-based domain-specific languages, serialization frameworks, and compact-slot storage strategies. Implementations vary in support for MOP completeness; for example, some vendors add proprietary facilities influenced by Franz Inc. engineering or research prototypes from MIT AI Lab.

Usage and examples

Common usage patterns include modeling domain entities with defclass, composing behavior via multiple inheritance, and implementing polymorphic APIs using defgeneric and defmethod. Example idioms appear in books and tutorials from authors and institutions such as Guy L. Steele Jr., Richard P. Gabriel, and classroom materials from MIT and Stanford. CLOS is used in applications ranging from symbolic computation in IBM research contexts to commercial expert systems and AI tooling at companies like Lucid and Franz Inc.. Its reflective facilities make it suitable for building DSLs, rule engines, and adaptable middleware in both academia and industry.

Category:Common Lisp