- From: Kay, Michael <Michael.Kay@softwareag.com>
- Date: Wed, 23 Jan 2002 19:46:03 +0100
- To: "'Mike Schilling'" <mschilling@edgility.com>, www-xpath-comments@w3.org
> >>If keywords are required, a much better choice is to make them > >>distinguishable from path elements, i.e. forbid them from > matching the XML > >>Name production. Requiring them to begin with a colon > (like the proposed, > >>unacceptable syntax for path element escaping) is one possibility. > > > > This is one of many designs that have been discussed. There > are at least > > some people who feel this would make XQuery more awkward to > use. Also note > > that this would introduce an incompatibility with XPath > 1.0, which has no > > such requirement. > > I'm not sure what you mean. XPath 1.0 has no keywords (as opposed to > axis names, operator names, function names, etc.) We often fall into this trap when we use the term "keyword", because actually it has no definition in the language. XPath 1.0 arranges that all names that are used as something other than element names in a location path can be recognized as such by context-sensitive lexical analysis (either because they are followed by something special, e.g. "::" or "(") or by virtue of the preceding token). We have managed to retain this principle in XPath 2.0. In the richer grammar of XQuery, it's almost impossible to do this. It would be possible in principle to ensure that the XQuery grammar used a non-name (such as #define) in all contexts where such discrimination isn't possible, but the current sentiment in the Query WG is that escaping element names that clash with these names is preferable, because it means that escaping would rarely be necessary, while if "keywords" were escaped then it would always be necessary. It's fair to point out that the issue of reserved words has been a significant area of difference between the XSL and XML Query working groups. I don't believe this can be traced to any objective difference in the user requirements that each group is trying to satisfy; rather, each group has inherited a different cultural tradition of language design that it attaches importance to. Mike Kay
Received on Wednesday, 23 January 2002 13:46:13 UTC