home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!charnel!sifon!CC.UMontreal.CA!kardank
- From: kardank@ERE.UMontreal.CA (Kardan Kaveh)
- Newsgroups: comp.lang.lisp
- Subject: Automatic evaluation of expression in CLOS slots
- Message-ID: <1993Jan3.023306.25733@cc.umontreal.ca>
- Date: 3 Jan 93 02:33:06 GMT
- Sender: news@cc.umontreal.ca (Administration de Cnews)
- Organization: Universite de Montreal
- Lines: 26
-
- 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
-