[Bese-devel] Some issues
Attila Lendvai
attila.lendvai at gmail.com
Sun Oct 7 12:23:02 UTC 2007
> But the welcome-component instance is not available and at the same time the
> 'items' initform is required. Besides, I have to indicate that the menu slot
> is a component, so I have to instance something there. Am I correct?
you can add an initialize-instance :after method to do the same. not
too nice, but you can't access the instance when initforms are
executed.
> So, when this happens (and this is happenning quite often), I do:
> (defcomponent welcome-component (simple-window-component)
> ((menu :accessor welcome-component.menu :component
> (standard-menu :title "" :items nil)) <--- I DO THIS JUST
> TO SAY I HAVE A COMPONENT IN MENU, maybe there's a better way
> )
add (myslot :component t) to the slot definition.
> 2) Iterate and macrolet problems (binding issues)
>
> Sometimes some symbols seem to be unbound when I use iterate or macrolet.
> In general, I can fix that using lambda, but maybe you know why that happens
> and how to fix it.
iterate does not add the variable it defines to the macroexpand
environment. there's no easy way to fix this, iterate should use a
compatibility layer above environments and update it.
as of macrolet, it may be a deficiency of arnesi's code walker, but i
seem to remember fixes recently. are you using the latest from darcs
(the boxset does that)?
> (:render ()
> (<:p (<:as-html (menu.title standard-menu)))
> (<:ul
> (iter
> (for (item-name . item-func) in (menu.items standard-menu))
> (<ucw:a :action (funcall item-func) (<:as-html item-name))))))
>
> because item-func does not get bound when referring it from the <ucw:a
> action.
you can workaround that by using a let outside the iter and setf-ing the var.
also note that iter does not create a new binding (so all you action
lambdas would capture the values from the last iteration if it
worked...
--
attila
More information about the bese-devel
mailing list