[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

slot initializations



	Given this form:
    
    (defflavor foo
	    ((a 1)
	     (b 2)
	     (c 3))
	    ()
      :initable-instance-variables
      :writable-instance-variables
      :abstract-flavor)
    
    Is there a way to programmatically determine
    the default values for the instance variables of foo?


Try

(defflavor foo
      ((a 1)
       (b 2)
       (c *bar*))
      ()
  
  :writable-instance-variables
  :initable-instance-variables
  :abstract-flavor
  )

(defflavor 1my-foo
0      ()
      (foo))

(third (multiple-value-bind (ignore l ignore)
	   (COLLECT-FLAVOR-INITIALIZATIONS 'my-foo 'c)
	 (first l)))

This is the only way I know to discover the initializations which are
not local to the flavor.  Also remember that the initializations are in
general, forms.  The system treats constants a little differently than
it treats forms, but COLLECT-FLAVOR-INITIALIZATIONS finds them all.  If
you want to know the value of an initialization, you'll have to eval it,
just like Make-instance does (in a null context).

  -- Paul Vaughan