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

Re: accessing default values in classes



  Redistributed: commonloops.pa
  Date: Thu, 1 Feb 90 19:52:05 CST
  From: "Peter N. Saurugger" <peter-s@molbio.cbs.umn.edu>
  To: commonloops.pa@xerox.com
  Subject: accessing default values in classes
  Cc: norbert@molbio.cbs.umn.edu
  
  I would like to find out whether there is a defined way of accessing the
  default values in classes. The accessors seem to work only with instances
  for me.
  
  I probably should point out why I would like to have this feature: I am
  currently building a blackboard-based system. This system reasons about
  strings of instances of pre-defined classes. Under certain circumstances 
  (e.g. data input) I need to create an object which matches to the default 
  value of a certain slot. It seems that I have to create a dummy instance 
  for each class to be able to access these values ...?
  
Slot descriptions are kept on the class, so you can access the default
value with something like:

(defun default-value (slot-name class)
  (slotd-initform (find-slotd 'name (class-slots class))))

Alternatively you could create a default instance, as you suggested,
and then just get a slot value using an accessor.

k