Common Lisp Object System

Common Lisp Object System

Das Common Lisp Object System (kurz: CLOS) ist die objektorientierte Erweiterung der Programmiersprache Common Lisp. Es hat seine Ursprünge in Loops und Flavors, und ist im ANSI-Standard für Common Lisp spezifiziert.

CLOS wird (optional) durch das Metaobject Protocol (kurz: MOP) implementiert. Das MOP ist nicht standardisiert, viele Implementierungen halten sich aber im groben an die Spezifizierung aus dem Buch The Art of Metaobject Protocol (siehe Literaturangaben), welches oft einfach als AMOP bezeichnet wird.

Eigenschaften

CLOS erlaubt die Definition von Klassen mit Mehrfachvererbung, von Methoden und generischen Funktionen.

Da Common Lisp eine interaktive und inkrementelle Entwicklung von Programmen in einer Laufzeitumgebung erlaubt, können auch Klassen zur Laufzeit geändert werden. Dies kann z. B. durch Manipulation des Metaobjektprotokolls erreicht werden, das die Instanzen der geänderten Klassen konsistent hält. Dieses Verhalten kann durch den Programmierer angepasst werden. Insofern ist CLOS ein dynamisches und programmierbares Objektsystem.

Eine weitere Besonderheit gegenüber anderen objektorientierten Programmiersprachen wie Smalltalk oder Java ist die Tatsache, dass Methoden in CLOS nicht Klassen zugeordnet sind, sondern separaten generischen Funktionen.

Eine generische Funktion umfasst eine Menge von Methoden mit verschiedenen Signaturen. Beim Aufruf der generischen Funktion für eine Liste von Argumenten wird dynamisch diejenige Methode ausgewählt, deren Signatur am spezifischsten auf die Argumente passt. Generische Funktionen werden auch Multimethoden genannt, da die richtige Methode nicht nur aufgrund des ersten Arguments (in smalltalk-artigen Objektsystemen oft der Empfänger der Nachricht genannt) ausgewählt wird, sondern aufgrund der gesamten Argumentenliste. Dieses Verhalten, das in CLOS auf elegante Weise eingebaut ist, wird heutzutage auch in anderen Sprachen oft in Form der sogenannten Aspektorientierung nachgebaut.

Literatur

  • Gregor Kiczales, Jim des Rivieres und Daniel G. Bobrow: The Art of the Metaobject Protocol. MIT Press, Boston 1991, ISBN 0-262-61074-4
  • Andreas Paepcke (Editor): Object-Oriented Programming: the CLOS Perspective. MIT Press, Boston 1993, ISBN 0-262-16136-2

Weblinks


Wikimedia Foundation.

Игры ⚽ Поможем написать курсовую

Schlagen Sie auch in anderen Wörterbüchern nach:

  • Common lisp object system — Cette page est considérée comme un article à approfondir. Le Common Lisp Object System, souvent abrégé en CLOS (prononcé si lauss ), est l ensemble des primitives présentes dans le langage de programmation Common Lisp pour construire un programme …   Wikipédia en Français

  • Common Lisp Object System — For other uses, see Clos (disambiguation). The Common Lisp Object System (CLOS) is the facility for object oriented programming which is part of ANSI Common Lisp. CLOS is a powerful dynamic object system which differs radically from the OOP… …   Wikipedia

  • Common Lisp Object System — Cette page est considérée comme un article à approfondir. Le Common Lisp Object System, souvent abrégé en CLOS (prononcé si lauss ), est l ensemble des primitives présentes dans le langage de programmation Common Lisp pour construire un programme …   Wikipédia en Français

  • Common Lisp Object System (disambiguation) — Common Lisp Object System may refer to: Common Lisp Object System Clos network This disambiguation page lists articles associated with the same title. If an internal link led you here, yo …   Wikipedia

  • Common Lisp Object System — …   Википедия

  • Common Lisp — Paradigm(s) Multi paradigm: procedural, functional, object oriented, meta, reflective, generic Appeared in 1984, 1994 for ANSI Common Lisp Developer ANSI X3J13 committee Typing discipline …   Wikipedia

  • Common Lisp — est un langage fonctionnel impur de la famille Lisp. Sommaire 1 Introduction 2 Syntaxe 3 Types de données 3.1 Types scalaires …   Wikipédia en Français

  • Object-Oriented Programming in Common Lisp: A Programmer's Guide to CLOS — (1988, Addison Wesley, ISBN 0 201 17589 4) is a book by Sonya Keene on the Common Lisp Object System. Published first in 1988, the book starts out with the elements of CLOS and develops through the concepts of data abstraction with classes and… …   Wikipedia

  • Common Lisp the Language — is an influential book by Guy L. Steele about Common Lisp. Contents 1 History 1.1 Before standardization 1.2 During standardization 1.3 A …   Wikipedia

  • Common-Lisp — Inoffizielles Lisp Logo Basisdaten Paradigmen: multiparadigmatisch: funktional, prozedural …   Deutsch Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”