Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2007-07-12 18:39:03


David Abrahams wrote:
> on Thu Jul 12 2007, "Peter Dimov" <pdimov-AT-pdimov.com> wrote:
>
>>>> You're optimizing the wrong case
>>>
>>> I don't know about that. The kind of interface used above has
>>> become very popular in the Python world... because it's useful. It
>>> may not cover the entire domain of XML manipulations well, but it
>>> does cover an important corner.
>>
>> Maybe it is, maybe it does. But you are still optimizing the wrong
>> case; horrible procedural code for creating a toy XML.
>
> I don't understand what you're objecting to. The XML schema being
> generated is not realistic?

...

> Well, I didn't understand the point you were trying to make, whereas
> (of course) I find my own code immediately understandable.

The point I was trying to make is that when you write the XML generation
code in a modular way, there's much less incentive to DSEL things up.

The advantages of this style are not apparent in simple examples where
there's no reuse within the generated XML, either in the same document, or
across documents.

In other words, if the <author> tag occurs several times in the schema(s),
in different contexts, I'm able to just reuse my add_element overload that
takes a C++ author class, without repeating the same tags over and over in a
declarative way.

Similarly, if several elements in the schema have a lot of common, I can use
C++ inheritance to factor the common core into a base class and have it have
its own add_element function, which would save me the trouble of repeating
the common parts in each subclass element.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk