std.xml validity checking is absurd

Ali Çehreli acehreli at yahoo.com
Fri Feb 8 09:21:38 PST 2013


On 02/08/2013 09:00 AM, Stewart Gordon wrote:
 > Moreover, what do people think about the situation whereby check's sole
 > payload is to possibly throw an exception?
 >
 > Normally under an exception-handling system, the behaviour of a function
 > is: Do something, or if you cannot, then throw an exception.
 >
 > But what is the "something" in the case of check? As far as I can see,
 > XML validity isn't something that check needs in order to do its
 > business - rather, the validity checking _is_ the business. On this
 > basis, it probably ought to return a boolean indicating whether the
 > input string is a valid XML document.

Absolutely.

It should still throw if the task of checking fails e.g. for no memory 
for internal state.

Ali



More information about the Digitalmars-d mailing list