[Bese-devel] checkboxes

Julian Stecklina der_julian at web.de
Thu Mar 31 11:23:06 UTC 2005


On Thu, 31 Mar 2005 09:57:31 +0200
"Marco Baringer" <mb at bese.it> wrote:

> Julian Stecklina <der_julian at web.de> writes:
> 
> > (defmethod render-on ((res response) (range pic-range-select))
> >   (<ucw:form
> >    (<:table
> >     (loop
> >        for item in (items range)
> >        do (<:tr
> > 	   (<:td
> > 	    (render-range-select-item range item))
> > 	   (<:td
> > 	    (<ucw:input :type "checkbox"
> > 			:accessor (gethash item (hash range)))))))
> >    (<ucw:input :type "submit" :action (range-select range))))
> 
> i always get this wrong too, and i don't know of a "good" fix. the
> problem here is that :accessor uses a closure. (gethash item (hash
> range)) closes over range, whcih is good, and item, but loop does not
> create a new binding over each iteration, it merly modifies the
> current binding. try this:

Thanks. I read "Always use fresh bindings with loop" somewhere, but did
not make the mental leap, that loop modifies its bindings.

Regards,
-- 
Julian Stecklina

-- Common Lisp can do what C, C++, Java, PASCAL, PHP, Perl, (you --
-- name it) can do. Here's how:                                  --
--                                                               --
-- http://www.amazon.com/exec/obidos/ASIN/1590592395             --



More information about the bese-devel mailing list