[xquery-talk] static typing of XQuery?

Per Bothner per at bothner.com
Wed Sep 20 13:44:34 PDT 2006

Michael Kay wrote:
 > Per Bothner wrote:
>> How much interest is there in the "static typing" feature?
> There seem to be two clusters of interest in it: (a) Microsoft, and (b)
> academics.

Interesting; I didn't realize Microsoft was so interested.  The FS
specification lists 2 Microsoft names, which is the same as the
number of IBM names, so for outsiders it would not be obvious.

> I think that schemaless data is an important use case, and in my view
> pessimistic static typing is unusable with schemaless data.

My thinking, too.

> Doing pessimistic static typing for schema-aware queries is more reasonable,
> but there are still many cases where intermediate results are likely to be
> untyped. My advice would be to steer well clear.  Optimistic static typing
> (reporting errors only where the static type is disjoint from the required
> type), as implemented in Saxon, seems to be quite good at catching a wide
> class of programming mistakes.

Does Saxon implement full "optimistic static typing" or just some ad-hoc
subset?  By the former I mean the type system of the FS but, but with
more lenience ("optimism")?  If so, it seems that implementing full
static type checking should not be difficult.

My feeling (which seems to match yours) is that optimistic static
typing is useful and should perhaps be the default (pending further
experience), but pessimistic/strict typing would be nice to have as an
option for those who want it, but should not be the default.
	--Per Bothner
per at bothner.com   http://per.bothner.com/

More information about the talk mailing list