Re: Static Typing in XQ Update Test Suite

On Tue, 2010-01-19 at 02:41 +0000, Xavier Franc wrote:
>
> I would like to make just a few remarks (not only for my own sake):
> - I could not find any definition of Static Typing in plain English
>   in the specs, other than this section 5.2.3.

Section 2.2.3.1 says:
     Each expression is then assigned a static type (step SQ6).
     [Definition: The *static type* of an expression is a type such that,
     when the expression is evaluated, the resulting value will always
     conform to the static type.] If the Static Typing Feature is
     supported, the static types of various expressions are inferred
     according to the rules described in [XQuery 1.0 and XPath 2.0 Formal
     Semantics]. If the Static Typing Feature is not supported, the static
     types that are assigned are implementation-dependent.

     During the static analysis phase, if the Static Typing Feature is in
     effect and an operand of an expression is found to have a static type
     that is not appropriate for that operand, a type error is raised
     [err:XPTY0004]. If static type checking raises no errors and assigns
     a static type T to an expression, then execution of the expression on
     valid input data is guaranteed either to produce a value of type T or
     to raise a dynamic error.

If you're looking for a definition in plain English, that seems about as
good as you could hope for.

> In particular there is no mention whatsoever of optimistic or
> pessimistic checking.

That's true, but I'm inclined to think the spec is better off not
bringing in those terms. It doesn't need to, and the possible benefit is,
in my opinion, more than offset by the possible harm. (Even within the
Working Group, there is some disagreement about exactly what the terms mean.)

>   But perhaps all this it entirely obvious to adepts of Formal
> Semantics.

Perhaps not *obvious*, but my guess is that it would be fairly clear to
someone who was setting out to implement the Static Typing Feature.

> - The term "static typing" is in itself too vague and therefore
> confusing.

Is there something vague or confusing about the paragraphs I quoted above?

> - All tests in XQTS related to ST can in fact be passed by an
>   implementation that does *not* support ST but works as stated
>   in section 5.2.3 ...

Yes, that's a very regrettable situation. I tried to ensure that it
wouldn't happen in the Update Facility's test suite.

-Michael Dyck

Received on Tuesday, 16 February 2010 04:07:54 UTC