[Bug 5727] [XQuery] Syntax ambiguities with leading "/"

http://www.w3.org/Bugs/Public/show_bug.cgi?id=5727


Jonathan Robie <jonathan.robie@redhat.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jonathan.robie@redhat.com




--- Comment #5 from Jonathan Robie <jonathan.robie@redhat.com>  2008-06-24 09:13:35 ---
The following NOTE, which occurs in both the XPath and the XQuery specs, seems
to cover the original intent of the Working Group:

<quote>
Note:

The "/" character can be used either as a complete path expression or as the
beginning of a longer path expression such as "/*". Also, "*" is both the
multiply operator and a wildcard in path expressions. This can cause parsing
difficulties when "/" appears on the left hand side of "*". This is resolved
using the leading-lone-slash constraint. For example, "/*" and "/ *" are valid
path expressions containing wildcards, but "/*5" and "/ * 5" raise syntax
errors. Parentheses must be used when "/" is used on the left hand side of an
operator, as in "(/) * 5". Similarly, "4 + / * 5" raises a syntax error, but "4
+ (/) * 5" is a valid expression. The expression "4 + /" is also valid, because
/ does not occur on the left hand side of the operator.</quote>

As I understand it, the clearest statement we have on the subject is this:

<quote>Parentheses must be used when "/" is used on the left hand side of an
operator, as in "(/) * 5".</quote>

Unfortunately, it does not clearly say that it is a syntax error to use "/" on
the left hand side of an operator, and it does not clearly say how to handle
operators like "-" or "+", which may be unary or binary.

And of course, this is in a Note, and notes aren't normative in our spec. If an
implementor faithfully ignored the Note, their implementation would not be
compatible with an implementation that took this statement into consideration.

Users are unlikely to write expressions that use / on the left hand side of an
operator. I do not know whether implementations have used the Note: to guide
their implementation.

So what are our options?

1. We could state normatively that "/" may not occur on the left hand side of
an operator. We would have to clarify the behavior with respect to unary
operators, e.g. whether /-5 is interpreted as /(-5). We would have to tell
implementors who ignored the Notes, as we told them they could, to change their
implementation.

2. We could remove the normative-sounding statement from the above Note in
order to avoid laying a trap for implementors who take our Notes too seriously.
We would then have to ask implementors who read the Note and implemented as
though it meant something to change their implementations to ignore the Note
entirely.

3. We could say it's implementation-defined whether implementors took our Note
seriously. This would institutionalize the bug forever, allowing implementors
to avoid changing anything.

Personally, I strongly prefer (1), I hate (3), and I can live with (2).

Jonathan


-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Tuesday, 24 June 2008 09:14:09 UTC