Re: Error definition

Bethan Tovey-Walsh <accounts@bethan.wales> writes:
> Trying to anticipate common logic errors, and provide useful feedback
> about them, is part of being a good programmer. I can imagine a
> variety of logic errors that an ixml implementor might want to catch:

Right. Here we have precisely the intersection between “what it means in
the spec” and “what a user might experience”. Both are important, but
the specification is only responsible for defining the former.

> providing an empty input string;

From the perspective of the spec, a perfectly reasonable input. Also, as
an implementor, I think it’s a perfectly reasonable input. No errors, no
real difference between the spec and my implementation.

> providing an input string with
> trailing whitespace characters;

From the perspective of the spec, a perfectly reasonable input. Also, as
an implementor, I think it’s a perfectly reasonable input. *But*,
trailing whitespace is a pain in the neck, so I’ve added an option on my
implementation that says “if your parse failed, but it would have
succeeded if there was no trailing whitespace”, then report success on
the characters up to the trailing whitespace.

This is absolutely not conformant behavior on the part of my processor,
but I’m okay with that.

> providing a binary file as an input
> string.

This is an interesting case. The specification is, as far as I can tell,
silent about what an “input string” may contain. I don’t think there’s
anything in the specification that prevents you from parsing a GIF file
with an ixml grammar.

My implementation is going to try to turn the input into a sequence of
characters. If you don’t specify an encoding, I’m going to try to make
them UTF-8 characters and there will very likely be an error. But I
think this is a bug in my implementation.

By the way, in case it’s been forgotten in the heat of this discussion,
the specification does already say that if the parse fails that fact has
to be reported to the user.

                                        Be seeing you,
                                          norm

--
Norm Tovey-Walsh
Saxonica

Received on Monday, 7 February 2022 12:46:54 UTC