Rainer Schuetze napisał:

> This looks nice and compact Using opDispatch to specify the tag (I guess 
> that is what you are using to create a tag "book" by calling xml.book()) 
> feels like misusing opDispatch, though. Does it add readability in 
> contrast to passing the tag as a string to some function?
> 
> How do you write a tag named "tight"? Or a tag calculated at runtime?

xml.tag("tight", attributes..., { make content });
 
That's the base implementation. opDispatch is just syntax sugar over it.

> Something more conventional would be
> 
>       xml.tag("book", attr("year", book.year), { ...
> 
> but I'm not sure that pairing the attribute name and value adds 
> readability or mere noise.

Putting name and value without a wrapper tuple is just sugar. Having some sort 
of structure representing an attribute is inevitable as we come at namespaces. 
In the end it should accept any range of (namespace-)name-value tuples as 
attributes.

-- 
Tomek

Reply via email to