RE: Variable Declaration in Query Prolog

That's seems right, but the grammar is not the issue. The issue is that
LET bound variables (and FOR bound variables) are currently typed by the
expression and not by an explicit type declaration. Asserting types is
done by an ASSERT. 

So this is more of a design issue and so far the WG felt that having
both ways (implicit type inference and explicit type assertion) is the
right thing to do.

If you do not agree, please submit your proposal to the official
comments list (if you have not already done so) and the working group
will surely consider it.

Best regards
Michael (speaking for himself)

> -----Original Message-----
> From: TAN Kuan Hui [mailto:kuanhui@mobileworkspace.com]
> Sent: Sunday, February 03, 2002 18:40 PM
> To: Michael Rys; www-ql@w3.org
> Subject: 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 Tuesday, 5 February 2002 11:26:26 UTC