Re: Variable Declaration in Query Prolog

We can replace
[52]   Param ::= Datatype? Variable
by
[52]  Variable ::= Datatype? "$" QName

and 
replace all Param with Variable
drop terminal [158] Variable ::= "$" QName

and that would make variables declarative w/o a major
impact on the grammar. Right ?


----- Original Message ----- 
From: "Michael Rys" <mrys@microsoft.com>
To: "TAN Kuan Hui" <kuanhui@mobileworkspace.com>; <www-ql@w3.org>
Sent: Monday, February 04, 2002 0:28 AM
Subject: RE: Variable Declaration in Query Prolog


> Variables in XQuery are mainly named subexpressions (due to the
> functional characteristic). To achieve type checking use ASSERT, CAST or
> TREAT.
> 
> Best regards
> Michael
> 
> > -----Original Message-----
> > From: TAN Kuan Hui [mailto:kuanhui@mobileworkspace.com]
> > Sent: Wednesday, January 23, 2002 17:43 PM
> > To: www-ql@w3.org
> > Subject: Variable Declaration in Query Prolog
> > 
> > Hi,
> > 
> > Could anyone shed some light as to why variable declaration shouldn't
> > be declared in the query prolog ? Wouldn't variable declaration be
> > desirable for static-typing to be more effective ?
> > Vis-a-vis, variables can be made to default to type Item if
> > it was not declared and thereafter down-cast accordingly ?
> > 
> > Ref : 2.1.1.1 Static Context (XQuery 1.0)
> > Quote : "Unlike the other parts of the static context, variable types
> are
> > not declared in the query prolog. Instead, they are derived from
> static
> > analysis of the expressions in which the variables are bound"
> > 
> > Thanks.
> > Kuan Hui
> > 
> > 
> > 
> > 
> > 
> > 
> 

Received on Sunday, 3 February 2002 21:40:42 UTC