Re: static typing and computed elements

Hello Jerome,

You (Jerome Simeon) wrote:
> Holger,
> 
> The XQuery static typing handles dynamic element names fine. The trick
> is to realize that wildcard names are part of the type system and can be
> used to type such an operation.
> 
> For instance:
> 
> element title { "Lord of the Rings" }
>  has type
> element title { xs:string }
> 
> and:
> 
> element { if $language = "french" then "titre" else "title" } { "LoTR" }
>  has type
> element * { xs:string }
> 
> where the * is a wildcard that stands for all possible QNames.
> 
> So you can statically type this expression without problem, you just get
> a less precise type.

A type that stands for all possible types precisely.  If the evaluation
generates a value that is not a QName at all than a dynamic type
exception happens?  Or did XQuery not check the type during the
evaluation phase in this circumstance?

Is that really static typing anymore?

> You can see more details about the typing for element constructors in
> section 4.4 of the XQuery formal semantics (June working draft).

You are right, I'll have a closer look at that draft.

Regards

Holger

-- 
Holger Meyer, Uni of Rostock, Dpt. of CS, DB Research Group
hm at GUUG.de, http://www.informatik.uni-rostock.de/~hme/

Received on Thursday, 17 January 2002 10:57:23 UTC