[plt-scheme] Swindle with-slots bug or doc bug?

From: Eli Barzilay (eli at barzilay.org)
Date: Wed Jan 11 16:00:38 EST 2006

On Jan  5, Will M. Farr wrote:
> Hello all,
> 
> I've been confused about something that seems to me to be a discrepancy 
> between the Swindle docs and the behavior of swindle.  Is this really a 
> problem, or is my inexperience with CLOS/Swindle getting the better of 
> me:
> 
> Swindle docs:
> (with-slots obj (slot ...) body ...)   [syntax]
> 
>    Evaluate the body in an environment where each 'slot' is defined as a
>    symbol-macro that accesses the corresponding slot value of 'obj'.
>    Each 'slot' is either an identifier 'id' which makes it stand for
>    `(slot-ref obj 'id)', or `(id slot)' which makes 'id' stand for
>    `(slot-ref obj 'slot)'.
> 
> -----
> 
> (with-slots b1 ((m1 m) (q1 q))
>        (with-slots b2 ((m2 m) (q2 q))
> ...))  => expand: unbound variable in module in: q
> 
> -----
> 
> (with-slots b1 ((m1 'm) (q1 'q))
>        (with-slots b2 ((m2 'm) (q2 'q))
> ...)) => OK.
> 
> It looks to me like the docs say that swindle adds the appropriate
> quote around the slot name, but that's not the actual behavior.
> Obviously, it's not serious, but I'd like to know if I'm just crazy
> or if it's really a mistake.

Yes, it looks like a mistake.  I no longer remember whether it was
intentional to have the form not add the quote or not -- but it seems
better to leave it as it is, since you can do

  (with-slots x ([foo (get-slot-name)])
    ...)

so I have updated the doc and left the behavior as is.

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


Posted on the users mailing list.