Re: static typing and computed elements

The types in the static type system form a range.

   element

Stands for any element with any content.

   element name { xsd:string }

Stands for an element with name "name" and content of type xsd:string.

Normally, you get the more precise types, but in some situations (and
computed elements are one of these) you get more general types, such
as "element".  When the type information is less precise, in order for
static typing to succeed you may need to specify what type you expect
and check at run-time that the data indeed has this type.  There is
a "treat as" expression for this purpose.  All of this is detailed
in the Formal Semantics document.  It's explained in the current
Formal Semantics document, but a new version better aligned with
the current XQuery document is under preparation.

Yours,  -- P

-----------------------------------------------------------------------
Philip Wadler                                          wadler@avaya.com
Avaya Labs               http://www.research.avayalabs.com/user/wadler/
233 Mount Airy Road, room 2C05                  office: +1 908 696 5137
Basking Ridge, NJ 07920                            fax: +1 908 696 5402
USA                                               home: +1 908 626 9252
                                                  cell: +1 908 872 4436
-----------------------------------------------------------------------
"When a Mathematical Reasoning can be had it's as great a folly to make
use of any other, as to grope for a thing in the dark,  when you have a
Candle standing by you."                        -- John Arbuthnot, 1692
-----------------------------------------------------------------------

Received on Thursday, 17 January 2002 12:25:27 UTC