Subject: Re: The limits of lisps synatactic gymnastics? (i sure hope not)
From: rpw3@rpw3.org (Rob Warnock)
Date: Sun, 02 Oct 2005 21:43:08 -0500
Newsgroups: comp.lang.lisp
Message-ID: <S8ydnSmiT6QhB93eRVn-hQ@speakeasy.net>
Peter Seibel  <peter@gigamonkeys.com> wrote:
+---------------
| Pascal Costanza <pc@p-cos.net> writes:
| > (defclass hash-slots-object ()
| >    ((hash-slots
| >      :accessor hash-slots
| >      :initform (make-hash-table :test #'eq))))
| >
| > (defmethod slot-missing ... )
| >
| > Just use hash-slots-object as a mixin, and you can do what you want.
| 
| Though he will have to use SLOT-VALUE, i.e.
|   (setf (slot-value obj 'name) "Barney")
| rather than:
|   (setf (name obj) "Barney")
+---------------

Yes, but he *will* be able to use WITH-SLOTS [which he wouldn't
with some of the other alternatives proposed in this thread]:

    > (setf (slot-value obj 'name) "Barney")

    "Barney"
    > (setf (slot-value obj 'age) 42)

    42
    > (with-slots (name age) obj
	(format t "~a is ~a.~%" name age))
    Barney is 42.
    NIL
    > 

I find that to be neat, for some odd reason...  ;-}


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607