[Bug 4446] [XQuery] 2.3.4 Equivalent expressions

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





------- Comment #7 from mike@saxonica.com  2007-06-17 23:15 -------
>As an example, consider the case that the conditional expression is operand of the fn:count function, and that both branches consist of function calls whose signature guarantees exactly one result item. It seems to me that your wording would permit to rewrite the conditional expression as the expression "1", whereas the original proposal would not allow such a rewrite, because it would amount to returning the result of a branch that has not been selected.

I think that it in cases where the result of an expression can be deduced from
(complete or partial) knowledge of the static type, then it should always be
possible to return the result without actually evaluating the expression. For
example, it is legitimate to return "true" as the result of

(if (EXPR) then 1 else 2) instance of xs:integer

without evaluating EXPR, and the same applies to

exists(if (EXPR) then 1 else 2)

Received on Sunday, 17 June 2007 23:15:37 UTC