From: Manuel Kolp
Subject: Can I generate a DEFCLASS MACRO with a method
Date: 
Message-ID: <559okl$8kq@sci3.sri.ucl.ac.be>
I would like to know if it is possible in CLOS to automatically 
generate an underlying DEFCLASS MACRO with a method attached 
on a (meta) metaclass.

For instance, can CLOS directly generate the following specifications
or code similar to:


;;; DEFINITION OF THE CLASS

(defclass newspaper (class-obj-mgr)
   ((title :initarg title :accessor title) 
    (type :initarg type :accessor type)
    (editor_in_chief :initarg editor_in_chief 
                     :accessor editor_in_chief)        
    (publisher :initarg :publisher 
                     :accessor publisher)) 
    (printer :initarg :printer :accessor printer)) 
    (:metaclass model-class))
         
;;;   INSTANCIATION OF ATTRIBUTES OF MODEL-CLASS FOR NEWSPAPER 

(setf (specific-attr-down (find-class 'newspaper)) 
            (list 'type 'editor_in_chief))
(setf (derived-attr (find-class 'newspaper)) 
            (list 'title 'nb_of_words))


from a method new-model-class

(new-model-class model-class :classname 'newspaper 
         :attributes (list 'title 'type 
                   'editor_in_chief 'publisher 'printer)
         :specific-attr-down (list 'type 'editor_in_chief)
         :derived-attr (list 'title 'nb_of_words))


if I have a metaclass model-class


;;; DEFINITION OF THE METAOBJECT CLASS MODEL-CLASS

(defclass model-class ()
     ((specific-attr-up :initform nil :initarg 
                       :specific-attr-up 
                       :accessor specific-attr-up)
      (specific-attr-down :initform nil 
               :initarg :specific-attr-down 
               :accessor specific-attr-down)
      (derived-attr :initform nil :initarg 
               :derived-attr :accessor derived-attr)
     (:metaclass meta-constructor))
)


and a meta-metaclass meta-constructor including 
the method new-model-class

;;; DEFINITION OF THE METAOBJECT CLASS META-CONSTRUCTOR

(defclass meta-constructor () () (:metaclass standard-class)

(defmethod new-model-class ((metaclass meta-constructor)
           &key classname superclasses attributes
		specific-attr-up specific-attr-down derived-attr))
		
)


Thanks in advance


Manuel Kolp
ยทยทยทยท@qant.ucl.ac.be
IAG-QANT
1, Place des Doyens
1348 Louvain-La-Neuve