[Bug 1655] [FS] need examples of when to raise a type error

http://www.w3.org/Bugs/Public/show_bug.cgi?id=1655





------- Additional Comments From fred.zemke@oracle.com  2005-07-25 19:38 -------
See comment #1605, additional comment #1, list item 3, in which it is stated
that there are indeed expressions for which no type can be deduced.  
I conclude that there are two scenarios for static type errors:

1. an expression for which no formal type can be deduced

2. an expression for which "statEnv |- Expr : empty" can be deduced, and
Expr is not one of the three permitted kinds of expressions of empty type.

Note that these two scenarios cannot be reduced to each other.

Accordingly, the fix for section 4 "Expressions" is to describe both of these
scenarios separately.  For scenario 1, there is no inference to state, since
the formal language of inferences is not powerful enough to express the 
concept, "statEnv | not (for all Type) [Expr : Type]".  And even if the 
language was extended to include this kind of judgment, you would have to
add the whole machinery necessary to draw conclusions of that sort.
Rather, this case is
handled through the definition of the inference engine, which should say 
that the objective is to either conclude "statEnv |- Expr : Type" for 
some particular Type, given the user's Expr and initial statEnv, or else to
conclude that there is no such Type.

For scenario 2, it is possible to state an inference, but it is not the one
shown in the specification.  The correct inference is

statEnv |- Expr : empty
not (Expr is empty sequence expression () or ... )
--------------------------------------------------
statEnv |- Expr raises typeError

Received on Monday, 25 July 2005 19:38:44 UTC