<s>
The	O
Common	B-Application
Lisp	I-Application
Object	I-Application
System	I-Application
(	O
CLOS	B-Application
)	O
is	O
the	O
facility	O
for	O
object-oriented	B-Language
programming	I-Language
which	O
is	O
part	O
of	O
ANSI	B-Language
Common	I-Language
Lisp	I-Language
.	O
</s>
<s>
CLOS	B-Application
is	O
a	O
powerful	O
dynamic	B-Language
object	B-Language
system	I-Language
which	O
differs	O
radically	O
from	O
the	O
OOP	B-Language
facilities	O
found	O
in	O
more	O
static	O
languages	O
such	O
as	O
C++	B-Language
or	O
Java	B-Language
.	O
</s>
<s>
CLOS	B-Application
was	O
inspired	O
by	O
earlier	O
Lisp	O
object	B-Language
systems	I-Language
such	O
as	O
MIT	B-Language
Flavors	I-Language
and	O
CommonLoops	B-Language
,	O
although	O
it	O
is	O
more	O
general	O
than	O
either	O
.	O
</s>
<s>
Originally	O
proposed	O
as	O
an	O
add-on	O
,	O
CLOS	B-Application
was	O
adopted	O
as	O
part	O
of	O
the	O
ANSI	O
standard	O
for	O
Common	B-Language
Lisp	I-Language
and	O
has	O
been	O
adapted	O
into	O
other	O
Lisp	O
dialects	O
such	O
as	O
EuLisp	B-Language
or	O
Emacs	B-Operating_System
Lisp	I-Operating_System
.	O
</s>
<s>
The	O
basic	O
building	O
blocks	O
of	O
CLOS	B-Application
are	O
methods	O
,	O
classes	O
,	O
instances	O
of	O
those	O
classes	O
,	O
and	O
generic	O
functions	O
.	O
</s>
<s>
CLOS	B-Application
provides	O
macros	O
to	O
define	O
those	O
:	O
defclass	O
,	O
defmethod	O
,	O
and	O
defgeneric	O
.	O
</s>
<s>
Instances	O
are	O
created	O
with	O
the	O
method	B-Language
make-instance	O
.	O
</s>
<s>
Classes	O
can	O
have	O
multiple	O
superclasses	O
,	O
a	O
list	O
of	O
slots	O
(	O
member	O
variables	O
in	O
C++	B-Language
/Java	O
parlance	O
)	O
and	O
a	O
special	O
metaclass	B-Language
.	O
</s>
<s>
Each	O
slot	O
in	O
a	O
CLOS	B-Application
class	O
must	O
have	O
a	O
unique	O
name	O
.	O
</s>
<s>
CLOS	B-Application
is	O
a	O
multiple	O
dispatch	O
system	O
.	O
</s>
<s>
Methods	O
in	O
CLOS	B-Application
are	O
grouped	O
into	O
generic	O
functions	O
.	O
</s>
<s>
Since	O
Common	B-Language
Lisp	I-Language
provides	O
non-CLOS	O
classes	O
for	O
structures	O
and	O
built-in	O
data	O
types	O
(	O
numbers	O
,	O
strings	O
,	O
characters	O
,	O
symbols	O
,	O
...	O
)	O
,	O
CLOS	B-Application
dispatch	O
works	O
also	O
with	O
these	O
non-CLOS	O
classes	O
.	O
</s>
<s>
CLOS	B-Application
also	O
supports	O
dispatch	O
over	O
individual	O
objects	O
(	O
eql	O
specializers	O
)	O
.	O
</s>
<s>
CLOS	B-Application
does	O
not	O
by	O
default	O
support	O
dispatch	O
over	O
all	O
Common	B-Language
Lisp	I-Language
data	O
types	O
(	O
for	O
example	O
dispatch	O
does	O
not	O
work	O
for	O
fully	O
specialized	O
array	O
types	O
or	O
for	O
types	O
introduced	O
by	O
deftype	O
)	O
.	O
</s>
<s>
However	O
,	O
most	O
Common	B-Language
Lisp	I-Language
implementations	O
provide	O
a	O
metaobject	O
protocol	O
which	O
allows	O
generic	O
functions	O
to	O
provide	O
application	O
specific	O
specialization	O
and	O
dispatch	O
rules	O
.	O
</s>
<s>
Dispatch	O
in	O
CLOS	B-Application
is	O
also	O
different	O
from	O
most	O
OO	O
languages	O
:	O
</s>
<s>
Selected	O
methods	O
from	O
this	O
list	O
are	O
then	O
combined	O
into	O
an	O
effective	O
method	B-Language
using	O
the	O
method	B-Language
combination	O
used	O
by	O
the	O
generic	O
function	O
.	O
</s>
<s>
The	O
effective	O
method	B-Language
is	O
then	O
called	O
with	O
the	O
original	O
arguments	O
.	O
</s>
<s>
Changing	O
the	O
method	B-Language
combination	O
also	O
may	O
lead	O
to	O
different	O
effective	O
methods	O
.	O
</s>
<s>
Like	O
the	O
OO	O
systems	O
in	O
most	O
dynamic	B-Language
languages	I-Language
,	O
CLOS	B-Application
does	O
not	O
enforce	O
encapsulation	B-Application
.	O
</s>
<s>
The	O
former	O
two	O
are	O
invoked	O
prior	O
to	O
,	O
or	O
after	O
the	O
primary	O
method	B-Language
,	O
in	O
a	O
particular	O
order	O
based	O
on	O
the	O
class	B-Language
hierarchy	I-Language
.	O
</s>
<s>
An	O
:around	O
method	B-Language
can	O
control	O
whether	O
the	O
primary	O
method	B-Language
is	O
executed	O
at	O
all	O
.	O
</s>
<s>
Additionally	O
,	O
the	O
programmer	O
can	O
specify	O
whether	O
all	O
possible	O
primary	O
methods	O
along	O
the	O
class	B-Language
hierarchy	I-Language
should	O
be	O
called	O
or	O
just	O
the	O
one	O
providing	O
the	O
closest	O
match	O
.	O
</s>
<s>
The	O
Standard	O
Method-Combination	O
provides	O
the	O
primary	O
,	O
before	O
,	O
after	O
and	O
around	O
methods	O
explained	O
above	O
.	O
</s>
<s>
There	O
are	O
other	O
Method-Combinations	O
with	O
other	O
method	B-Language
types	O
.	O
</s>
<s>
New	O
(	O
both	O
simple	O
and	O
complex	O
)	O
Method-Combinations	O
and	O
method	B-Language
types	O
can	O
be	O
defined	O
.	O
</s>
<s>
CLOS	B-Application
allows	O
multiple	B-Application
inheritance	I-Application
.	O
</s>
<s>
When	O
the	O
default	O
order	O
in	O
which	O
methods	O
are	O
executed	O
in	O
multiple	B-Application
inheritance	I-Application
is	O
not	O
correct	O
,	O
the	O
programmer	O
may	O
resolve	O
the	O
diamond	O
inheritance	B-Language
problems	O
by	O
specifying	O
the	O
order	O
of	O
method	B-Language
combinations	O
.	O
</s>
<s>
CLOS	B-Application
is	O
dynamic	B-Language
,	O
meaning	O
that	O
not	O
only	O
the	O
contents	O
,	O
but	O
also	O
the	O
structure	O
of	O
its	O
objects	O
can	O
be	O
modified	O
at	O
runtime	O
.	O
</s>
<s>
CLOS	B-Application
supports	O
changing	O
class	O
definitions	O
on-the-fly	O
(	O
even	O
when	O
instances	O
of	O
the	O
class	O
in	O
question	O
already	O
exist	O
)	O
as	O
well	O
as	O
changing	O
the	O
class	O
membership	O
of	O
a	O
given	O
instance	O
through	O
the	O
change-class	O
operator	O
.	O
</s>
<s>
CLOS	B-Application
also	O
allows	O
one	O
to	O
add	O
,	O
redefine	O
and	O
remove	O
methods	O
at	O
runtime	O
.	O
</s>
<s>
The	O
Circle-Ellipse	B-Application
Problem	I-Application
is	O
readily	O
solved	O
in	O
CLOS	B-Application
,	O
and	O
most	O
OOP	B-Language
design	O
patterns	O
either	O
disappear	O
or	O
are	O
qualitatively	O
simpler	O
.	O
</s>
<s>
CLOS	B-Application
is	O
not	O
a	O
prototype	B-Application
language	I-Application
:	O
classes	O
must	O
be	O
defined	O
before	O
objects	O
can	O
be	O
instantiated	O
as	O
members	O
of	O
that	O
class	O
.	O
</s>
<s>
Outside	O
of	O
the	O
ANSI	B-Language
Common	I-Language
Lisp	I-Language
standard	I-Language
,	O
there	O
is	O
a	O
widely	O
implemented	O
extension	O
to	O
CLOS	B-Application
called	O
the	O
Metaobject	O
Protocol	O
(	O
MOP	O
)	O
.	O
</s>
<s>
The	O
MOP	O
defines	O
a	O
standard	O
interface	O
to	O
the	O
underpinnings	O
of	O
the	O
CLOS	B-Application
implementation	O
,	O
treating	O
classes	O
,	O
slot-descriptions	O
,	O
generic-functions	O
and	O
methods	O
themselves	O
as	O
instances	O
of	O
metaclasses	B-Language
,	O
and	O
allows	O
the	O
definition	O
of	O
new	O
metaclasses	B-Language
and	O
the	O
modification	O
of	O
all	O
CLOS	B-Application
behavior	O
.	O
</s>
<s>
The	O
flexibility	O
of	O
the	O
CLOS	B-Application
MOP	O
prefigures	O
aspect-oriented	B-Architecture
programming	I-Architecture
,	O
which	O
was	O
later	O
developed	O
by	O
some	O
of	O
the	O
same	O
engineers	O
,	O
such	O
as	O
Gregor	O
Kiczales	O
.	O
</s>
<s>
The	O
MOP	O
defines	O
the	O
behavior	O
of	O
the	O
whole	O
object	B-Language
system	I-Language
by	O
a	O
set	O
of	O
protocols	O
.	O
</s>
<s>
These	O
are	O
defined	O
in	O
terms	O
of	O
CLOS	B-Application
.	O
</s>
<s>
Thus	O
it	O
is	O
possible	O
to	O
create	O
new	O
object-systems	O
by	O
extending	O
or	O
changing	O
the	O
provided	O
CLOS	B-Application
functionality	O
.	O
</s>
<s>
The	O
book	O
The	O
Art	O
of	O
the	O
Metaobject	O
Protocol	O
describes	O
the	O
use	O
and	O
implementation	O
of	O
the	O
CLOS	B-Application
MOP	O
.	O
</s>
<s>
The	O
various	O
Common	B-Language
Lisp	I-Language
implementations	O
have	O
slightly	O
different	O
support	O
for	O
the	O
Meta-Object	O
Protocol	O
.	O
</s>
<s>
Flavors	B-Language
(	O
and	O
its	O
successor	O
New	B-Language
Flavors	I-Language
)	O
was	O
the	O
object	B-Language
system	I-Language
on	O
the	O
MIT	O
Lisp	B-Operating_System
Machine	I-Operating_System
.	O
</s>
<s>
Large	O
parts	O
of	O
the	O
Lisp	B-Operating_System
Machine	I-Operating_System
operating	O
systems	O
and	O
many	O
applications	O
for	O
it	O
use	O
Flavors	B-Language
or	O
New	B-Language
Flavors	I-Language
.	O
</s>
<s>
Flavors	B-Language
introduced	O
multiple	B-Application
inheritance	I-Application
and	O
mixins	B-Language
,	O
among	O
other	O
features	O
.	O
</s>
<s>
Flavors	B-Language
is	O
mostly	O
obsolete	O
,	O
though	O
implementations	O
for	O
Common	B-Language
Lisp	I-Language
do	O
exist	O
.	O
</s>
<s>
Flavors	B-Language
was	O
using	O
the	O
message	O
passing	O
paradigm	O
.	O
</s>
<s>
New	B-Language
Flavors	I-Language
introduced	O
generic	O
functions	O
.	O
</s>
<s>
CommonLoops	B-Language
was	O
the	O
successor	O
of	O
LOOPS	O
(	O
from	O
Xerox	O
Interlisp-D	B-Language
)	O
.	O
</s>
<s>
CommonLoops	B-Language
was	O
implemented	O
for	O
Common	B-Language
Lisp	I-Language
.	O
</s>
<s>
A	O
portable	O
implementation	O
called	O
Portable	O
CommonLoops	B-Language
(	O
PCL	O
)	O
was	O
the	O
first	O
implementation	O
of	O
CLOS	B-Application
.	O
</s>
<s>
PCL	O
is	O
widely	O
ported	O
and	O
still	O
provides	O
the	O
base	O
for	O
the	O
CLOS	B-Application
implementation	O
of	O
several	O
Common	B-Language
Lisp	I-Language
implementations	O
.	O
</s>
<s>
PCL	O
is	O
implemented	O
mostly	O
in	O
portable	O
Common	B-Language
Lisp	I-Language
with	O
only	O
a	O
few	O
system	O
dependent	O
parts	O
.	O
</s>
<s>
Because	O
of	O
the	O
power	O
and	O
expressivity	O
of	O
CLOS	B-Application
,	O
as	O
well	O
as	O
the	O
historical	O
availability	O
of	O
Tiny	O
CLOS	B-Application
(	O
a	O
simplified	O
portable	O
CLOS	B-Application
implementation	O
written	O
by	O
Gregor	O
Kiczales	O
for	O
use	O
with	O
Scheme	O
)	O
,	O
CLOS-like	O
MOP-based	O
object	B-Language
systems	I-Language
have	O
become	O
the	O
de	O
facto	O
norm	O
in	O
most	O
Lisp	O
dialect	O
implementations	O
,	O
as	O
well	O
as	O
finding	O
their	O
way	O
into	O
some	O
other	O
languages	O
 '	O
OOP	B-Language
facilities	O
:	O
</s>
