home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.lisp.mcl
- Path: sparky!uunet!spool.mu.edu!enterpoop.mit.edu!thunder.mcrcim.mcgill.edu!sifon!CC.UMontreal.CA!kardank
- From: kardank@ERE.UMontreal.CA (Kardan Kaveh)
- Subject: Automatic evaluation of expressions in class slots
- Message-ID: <1993Jan2.045508.12113@cc.umontreal.ca>
- Sender: news@cc.umontreal.ca (Administration de Cnews)
- Organization: Universite de Montreal
- Date: Sat, 2 Jan 1993 04:55:08 GMT
- 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
-