At 10:55 +0200 07.09.98, Heiko Kirschke wrote:
> > re: Does a MOP user really know the names of the slot where initforms and
> > initfunctions are stored?
> >
> > No.
>
>All definitions im AMOP are method-based; this gives a purely
>functional interface, which abstracts from a concrete implementation
>of CLOS. This idea was so good that it has even found its way into the
>non-LISP community (e.g. into the ODMG specification on o-o
>databases or into Java Beans).
>
>IMHO, one minor drawback in AMOP are the keyword arguments: This is
>the only place where the quite abstract definitions in AMOP meet quite
>closely an (imaginary) implementation of CLOS.
CLOS has a smart possibility to introduce "virtual" keywords with
methods for initialize-instance.
(defstruct position
x
y)
(defclass ship
()
((pos :accessor ship-position)))
(defmethod initialize-instance ((s ship) &key (x 0) (y 0))
(setf (ship-position s) (make-position :x x :y y)))
? (make-instance 'ship :x 5 :y 7)
#<SHIP #x2B42E7E>
? (ship-position *)
#S(POSITION :X 5 :Y 7)
?
The additional representation level with point objects in the example can
be used for spatial indexing with R-trees etc. However, using keywords for
make-instance does not necessarily mean sacrificing portability, i.e.
initializing an ship with a keyword :x or :y does not imply the init value
is stored directly in a slot x or y.
Regards,
Ralf
________________________________________
Ralf Moeller
University of Hamburg
Computing Science Department
Vogt-Koelln-Str. 30
22527 Hamburg
Germany
Tel.: +49 (40) 5494 2571 Fax: +49 (40) 5494 2572
Http://kogs-www.informatik.uni-hamburg.de/~moeller/
Email: <informatik.uni-hamburg.de at moeller>