[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Automatic evaluation of expressions in class slots
- To: info-mcl
- Subject: Automatic evaluation of expressions in class slots
- From: kardank@ERE.UMontreal.CA (Kardan Kaveh)
- Date: 2 Jan 93 04:55:08 GMT
- Newsgroups: comp.lang.lisp.mcl
- Organization: Universite de Montreal
- Sender: news@cc.umontreal.ca (Administration de Cnews)
I would like to be able to place expressions in class slots, and have them
transparently evaluated when accessed. Is there a standard way of doing
this? Do I need the Meta Object Protocol for this?
For example, I would like behaviour similar to the following:
(defclass foo ()
((slot-1 :accessor slot-1)))
(defvar x (make-instance 'foo))
(setf (slot-1 x) '(+ 2 2))
(slot-1 x) --> 4
(slot-value x 'slot-1) --> 4
(slot-expression x 'slot-1) --> '(+ 2 2)
Thanks,
Kaveh
--
------------
Kaveh Kardan kaveh@taarna.UUCP
Systeme Taarna kardank@eole.umontreal.qc.ca
Montreal Quebec Canada (514)844-8448