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 184.108.40.206 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
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
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.