W3C home > Mailing lists > Public > public-qt-comments@w3.org > September 2003

why special rule for numeric literal in a predicate?

From: Per Bothner <per@bothner.com>
Date: Fri, 12 Sep 2003 10:21:29 -0700
Message-ID: <3F620099.8010405@bothner.com>
To: public-qt-comments@w3.org

I'm curious why there is a special rule for a numeric
literal in (for example):

ForwardStep Predicates "[" Numeric "]"

By my reading, this expression:
   STEP[2]
is treated differently from:
   STEP[1+1]
or:
   let $x as xs:integer := 2 return STEP[$x]
or:
   declare variable $two := {2};
   STEP[$two]

My guess is that the translation to core XQuery
is meant to be a purely syntactic translation,
so it has to be done before type analysis.  Plus for the
re-write to be valid you would have to require that the
predicate be constant over the sequence, which I
supposed is difficult to define unless you introduce
the concept of "constant expression".

But given the restricted applicability of the
simplication for just numeric literals, what's
the point?  Is there is a specific need for a
stricter typing of just the numeric-literal case?
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/
Received on Friday, 12 September 2003 13:18:14 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:14 UTC