Lists Home |
Date Index |
Michael Kay wrote:
> > Please prove this assertion untrue. XML type systems (especially with
> > W3C XML Schema) are based on constraints. Constraints are runtime
> > issues....
> There's a misunderstanding here. No static analysis of any program can
> classify programs unambiguously as correct or incorrect; if that were the
> case it would never be necessary to execute a program. The purpose of
> checking is to reject as many incorrect programs as possible before
> executing them.
Exactly. Generally, if a logical analysis yields "false" for the entire
range of input, there is no need to "run" the program against any input e.g.
for all ?x (?x and not ?x)
since this is "false" for all things, there is no need to test individual
things i.e. run the program.
> ... An interesting design choice is the extent to which we
> reject the programs that might or might not be correct, depending on the
> input data. Typically we solve this by distinguishing structural
> constraints, which can be checked statically, from value-based
> which can't: but it's a fuzzy boundary.
The value based constraints need to be expressed against variables in the
program, for example, when operations are carried out against constants, any
decent compiler can easily factor these out i.e. "execute" the program
against the constant values. The formalism behind such analysis is discussed
as an "Abstract State Machine" see http://www.eecs.umich.edu/gasm/
As you say, the degree to which a compiler performs such optimizations is a