[Bese-devel] tal:dolist

Marco Baringer mb at bese.it
Fri Sep 23 11:52:10 UTC 2005


vlado tzankov <vtzankov at gmail.com> writes:

> tal:dolist="(something)" - (SOMETHING) returns a list of tal
> environment objects (which are themselves lists of alists, clos
> objects or hash tables).

let's pretend for a moment that dolist took a list of objects and just
iterated over those. how would we access the 'current' object? we'd
need ot decide on some arbitrary name for the current object (i think
i used yaclml:item in tal version -0.5) but why should yaclml impose
the name of the object? why not let the user decide what the best name
for the current object is? and why must there always be only one
object? what if you mant to iterate over a list cantainig both the
current item and it's index? how do you do that?

after thinking through all these questions i figured the best salution
was to just make dolist iterate over a list of tal environment
objects. this allows you to chose the best names for the objects in
question and have multiple objects available at each iteration.

that said there's no reason we couldn't create a tal:foreach tag with
the simpler api.

hth.

-- 
-Marco
Ring the bells that still can ring.
Forget the perfect offering.
There is a crack in everything.
That's how the light gets in.
	-Leonard Cohen



More information about the bese-devel mailing list