[Ecls-list] Improvements in CLOS

Juan Jose Garcia-Ripoll worm at arrakis.es
Mon Jul 21 01:04:18 UTC 2003


Hi,

this weekend I have been working hard on the CLOS implementation in ECL, 
trying to bring it closer to both the ANSI  the Metaobject protocol 
specifications. I have succeeded in the following things:

+ ECL no longer uses custom objects (formerly called DISPATCH-FUNCTIONs) to 
perform dispatching. Instead, something like #'MAKE-INSTANCE will always 
return a GENERIC-FUNCTION object. For instance, before
	(type-of #'MAKE-INSTANCE)
	=> DISPATCH-FUNCTION
now
	(type-of #'MAKE-INSTANCE)
	=> STANDARD-GENERIC-FUNCTION

+ To still have fast dispatch, the position of the slots of certain classes 
(STANDARD-CLASS, STANDARD-GENERIC-FUNCTION) is kept fixed. The most important 
consequence is that the metaobject accessors GENERIC-FUNCTION-LAMBDA-LIST, 
GENERIC-FUNCTION-METHODS, etc, are not generic functions but ordinary 
functions. These classes may be extended by the user, but one must be careful 
not to change the order of slots:
	(defclass my-class () (a-slot))
	(defclass my-g-f (generic-function my-class) ()) <<<< WRONG!
	(defclass my-g-f (my-class generic-function) ()) <<<< RIGHT!

+ The class initialization and finalization protocols have been implemented. 
That means we have now ENSURE-CLASS, ENSURE-CLASS-USING-CLASS, MAKE-INSTANCE, 
INITIALIZE-INSTANCE, SHARED-INITIALIZE, FINALIZE-INHERITANCE, COMPUTE-SLOTS, 
COMPUTE-DEFAULT-INITARGS, etc.

+ Default initalization arguments are canonicalized as the MOP says. However 
both the :INITFORM and :DEFAULT-INITARGS values differ from the MOP in that 
functions are not created for constant objects.

Important things to be solved:

+ Classes cannot be reinitialized. The class redefinition protocol in ECL 
replaces a class with the new one, marking the old one as INVALID. This 
differs both from ANSI and the AMOP. For the same reason, instance obsolence 
has not been implemented.

+ SLOT-VALUE, SLOT-BOUNDP, etc, are now generic functions which specialize on 
the class of the instance to be accessed.

I have not uploaded these improvements to CVS. Due to the highly experimental 
nature, and to the little testing, I have only made a patch file that anybody 
is free to try
	http://ecl.sf.net/patch-0.9-current-exp.gz





More information about the ecl-devel mailing list