Common Lisp Object System (CLOS)

What is the Common Lisp Object System (CLOS)?

The Common Lisp Object System (CLOS) is an advanced object-oriented programming system that is part of the Common Lisp language. CLOS provides a dynamic object model that allows changes to the class and method definitions to be reflected immediately in a running program. It was developed to integrate seamlessly with the functional features of Common Lisp and to provide flexible object-oriented capabilities that could support a variety of programming styles and paradigms.

Key Features of CLOS

  • Multiple Dispatch: Unlike most object-oriented systems that support only single dispatch, CLOS supports multiple dispatch. This means that method execution can depend on the runtime types (classes) of more than one of its arguments, providing more flexibility and power in method definition.
  • Metaobject Protocol (MOP): CLOS includes a metaobject protocol, an extensible architecture that allows programmers to customize the behavior of the object system itself. This can be used to modify aspects of the language's object-oriented behavior at runtime.
  • Method Combination: CLOS allows the definition of how methods combine when more than one method can be applied to an object. This includes standard method combination types like before, after, and around, which control the order of method execution.
  • Dynamic Rebinding of Classes: Classes in CLOS can be changed dynamically, and existing instances of a class can be updated to have the new structure without restarting the program.

Purpose of CLOS

The design of CLOS reflects a philosophy that emphasizes flexibility and dynamism, which align with the overall dynamic nature of Common Lisp. The purpose of CLOS is to:

  • Provide a powerful system that integrates well with the functional aspects of Common Lisp.
  • Offer a flexible toolset for object-oriented programming that can adapt to the needs of a variety of programming paradigms.
  • Enhance Lisp's ability to handle complex, large-scale software engineering tasks in a dynamically changing environment.

Importance of CLOS

CLOS is considered one of the most powerful object-oriented systems due to its comprehensive feature set and the high level of customizability it offers. Its importance and influence extend beyond Common Lisp, as it has inspired features in other programming languages and systems. Key points of importance include:

  • Dynamic Capabilities: CLOS's ability to redefine classes and methods on the fly makes it particularly suited for applications requiring adaptive behavior, such as artificial intelligence and rapid prototyping environments.
  • Multiple Dispatch: This feature makes CLOS unique and is particularly useful in situations where behavior depends equally on multiple objects, not just on a single receiver object.
  • Standardization: As part of the ANSI Common Lisp standard, CLOS provides a standardized way of applying object-oriented programming concepts in Lisp.

Examples of Usage

  • Artificial Intelligence: CLOS is often used in AI research and applications due to its ability to dynamically adapt object structures and behaviors in response to evolving conditions.
  • Complex System Simulations: The dynamic and customizable nature of CLOS makes it ideal for simulations where components might need to change over time.
  • Interactive Development: CLOS's capabilities are well-suited for interactive software development environments where developers can test and modify code on the fly.


The Common Lisp Object System (CLOS) represents a sophisticated approach to object-oriented programming, characterized by its flexibility, dynamic capabilities, and the powerful feature of multiple dispatch. Its integration into Common Lisp as a standard component makes it a critical tool for Lisp programmers and highlights the language's suitability for complex and dynamic application domains.

See Also

  • Common Lisp: An overview of the Common Lisp language, of which CLOS is a part, discussing its history, syntax, and features.
  • Object Oriented Programming (OOP): Explaining the general principles of OOP, including encapsulation, polymorphism, and inheritance.
  • Metaobject Protocol: A deeper dive into what MOPs are and how they work in various programming languages, with a focus on CLOS.
  • Multiple Inheritance: Discussing the concept, advantages, and potential problems associated with multiple inheritance in object-oriented design.
  • Generic Functions: Explaining how generic functions work in CLOS and how they differ from methods in other object-oriented languages.
  • Software Extensibility: Covering principles and practices for designing software systems that are intended to be easily extendable.
  • Dynamic Programming Languages: Discussing languages that allow for dynamic modifications of the program structure during runtime.