Re: Final draft of Proposed Binary Module

On 19 Nov 2013, at 11:01, Christian Grün <christian.gruen@gmail.com> wrote:

>> I'm inclinded to have two errors: [index-before-start] and [index-after-end]
>> - differentiating between them, which the machine of course can do, makes it
>> easier to track the error - before-start is more likely to be $offset wrong
>> etc.
> 
> I tend to handle semantically similar errors in the same way. As you
> already indicated, before-start is “more likely to be $offset wrong”,
> but as we don’t have any guarantee, both values need to be checked in
> both catch branches to be sure what was going on. Personally, I would
> even treat all out-of-bounds errors (incl. negative-offset and
> negative-size) with a single code for the very same reason; otherwise,
> the resulting XQuery code may get too bloated. What I wouldn’t do,
> however, is to also accept and normalize negative values, as has been
> done in XPath 1.0.
> 

Agreed. Remember that implementations can produce different messages to accompany the same error code. The only purpose of the error code is so that applications can catch it, which means that grouping related errors together generally makes life easier for the application.

(XPath 1.0 of course had the design philosophy of "no dynamic errors", which came from the browser culture. XPath 2.0 abandoned that.)

Michael Kay
Saxonica

Received on Tuesday, 19 November 2013 11:35:54 UTC