ITWissen.info - Tech know how online

common LISP object system (CLOS)

The Common LISP Object System (CLOS) is an extension of Common Lisp, which is based on one of the oldest programming languages - Lisp. With CLOS the implementation of object-oriented concepts together with the functional properties of Lisp is possible.

By combining this with the functional properties of Lisp, CLOS - and other languages of this type - is well suited for processing structural patterns, such as those used in artificial intelligence( AI) applications. This also combines object-oriented concepts with the advantages of Lisp( data are instructions, i.e., possibility of self-modification of programs). CLOS

as extensions

to Lisp CLOS is, strictly speaking, an extension of two object-oriented extensions to Lisp: New Flovors from Symbolics and Common Loops from Xerox. The extensions to Lisp include multiple inheritance, declarative method combination, a meta-object protocol, and genericity in methods, in addition to the flavor system (the embedding of class definitions, etc.).

There is no static type test, but there is a type system and type predicates. Each class in CLOS defines a Common Lisp type. Each value is an element of at least one CLOS class that can be determined at runtime. Some mechanisms of the static typing can be emulated thereby by the programmer.

Attributes (slots) have slot options for which different processing rules apply. The inheritance of methods depends on their role. From the :primary methods exactly one, the most specific one is inherited. Other methods can be associated with it in specific roles (:before-, :after- and :around-methods in a combination). Features of base classes are all inherited, but not equally in case of name conflicts. Methods are inherited in depth-first order of base class agreement according to the class-precedence-list. The value range of like-named attributes is the most specialized common supertype of inherited attributes.

The generic functions of CLOS

As a special feature there are generic functions. The choice of the implementation of such a function depends on the types of all arguments (not only of the receiver argument). Methods can therefore no longer be assigned to individual classes.

The design mechanism of the abstract class is not possible. Each class is instanziierbar. As programming convention there is however the use of so-called"mixins" for the purpose of the uniform protocol agreement. There are however no generic classes. Metaclasses and class objects are supported. There is a sophisticated meta-object protocol through which the semantics of CLOS is operationally described. It is available to the programmer to define classes with different behavior (e.g., processing of messages, construction of instances, etc.).

CLOS provides language concepts that restrict access to attributes. However, there are ways to override these mechanisms. A module concept is realized by so-called"packages".

CLOS has been standardized by ANSI as part of Common Lisp.

Informations:
Englisch: common LISP object system - CLOS
Updated at: 04.11.2013
#Words: 456
Links: list processing language (LISP), extension (EXTN), implementation, object (O), artificial intelligence (AI)
Translations: DE
Sharing:    

All rights reserved DATACOM Buchverlag GmbH © 2024