RE: [XPath/XQuery] syntax of variable reference

> 
> In the syntax, "$" VarName turns up in various places.
> This should be replaced by a non-terminal, e.g. VarRef,
> which would be defined as:
> 
>     VarRef ::= "$" VarName
> 
> Also, the syntax seems to allow a space after the $, but
> none of the examples have a space after the $. The above
> rule would allow to forbid whitespace with a /* ws: explicit 
> */. There seems to be no need to allow whitespace after the 
> $, it will only confuse users.

There is no reason to prohibit whitespace here, so why prohibit it? You
could apply the same argument to the whitespace that's permitted before
the "(" in a function call, or the whitespace that's permitted around
the "=" sign in XML start tags. It's arbitrary restrictions that confuse
users, not their absence.

(XPath 1.0 did prohibit whitespace here, and I had to implement a
special lexical state in my XPath tokenizer to enforce the restriction.
It causes an unnecessary interaction between the syntactic and lexical
levels of the language, for no user benefit.).

Michael Kay (speaking personally)

Received on Sunday, 15 February 2004 18:53:12 UTC