|
Boost : |
From: Stefan Seefeld (seefeld_at_[hidden])
Date: 2006-10-30 13:53:16
Oleg Abrosimov wrote:
> Hello Sebastian,
> let me share my ideas inspired by your post.
>
> First of all, I'm confused why there is the 'event' term is used if one
> needs to call 'next' method to get the next one? It looks like this is a
> good word here though, but it should be used more sequentially.
> In a current installment you can safely omit this word and think of your
> XMLReader as a
>
> std::copy(std::input_iterator<XMLObject>(std::cin),
> std::input_iterator<XMLObject>(), MyIteratorAdapterForXMLObject());
>
> where MyIteratorAdapterForXMLObject - is a user defined iterator that do
> the actual processing.
>
> Of course, this view is simplistic, but hope you catch the point:
> There is no place for the Event concept!
Right.
> But don't get me wrong, please, my point is that Boost.XML should be
> made around the real Event concept.
Let me rephrase that in order to make sure I really understand what you
are getting at here. This is about 'push' vs. 'pull', right ? While
the 'next()' approach suggests the user is indeed iterating over input
'tokens' that are getting pulled put of some input stream, you suggest
a toplevel 'parse_input' resulting in some underlying reactor to
push events on the user. Is that correct ?
If so, I disagree. I think it is perfectly fine to let the user keep
control over the iteration process.
The question is how to manage the fact that the tokens are polymorphic.
Can a call to 'next()' be combined with some statically typed handlers
that neither force the user to do the downcasting himself, nor does
force the base class interface be the union of all the wrapped interfaces.
(In fact one could wonder whether there needed to be a common base class
at all.)
Regards,
Stefan
-- ...ich hab' noch einen Koffer in Berlin...
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk