- From: <bugzilla@jessica.w3.org>
- Date: Fri, 28 Mar 2014 08:59:28 +0000
- To: public-qt-comments@w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=25160 --- Comment #5 from Michael Kay <mike@saxonica.com> --- Unfortunately the above proposal has a rather serious bug. The expression child::x gets rewritten to something like //*[self::x] which not only gives the wrong answer, it also has the wrong posture. There's also (at least one) further bug. The expression //x is not streamable unless the context item happens to be the document node, but it is equivalent to a motionless pattern and gets rewritten under the proposed rules. I'm therefore wondering about a different formulation. Delete section 19.1, and instead of preprocessing the expression tree, we do the streamability analysis as described and then have a second attempt if it fails. More specifically, in section 19.8.7.6 Streamability of Path Expressions, we recast the rules as follows: 1. Compute the provisional posture and sweep, as follows: (insert the existing rules) 2. If the provisional posture is roaming or the provisional sweep is free-ranging (or both), and if the path expression is a *scanning expression* (defined below), then the posture is crawling and the sweep is consuming. Otherwise, the posture and sweep of the path expression are the provisional posture and sweep. Definition: A *scanning expression* is a relative path expression in the form L/R that satisfies the following conditions: (a) each of the operands L and R is either (i) a scanning expression, or (ii) an AxisStep whose axis is child, descendant, descendant-or-self, or self. (b) the expression is the *equivalent expression* of some *motionless pattern*. (That is, when the expression is considered as a pattern, the rules for classifying patterns (19.8.9) deem the pattern to be motionless.) Rationale: note that we are no longer doing anything to change the semantics of the expression, we are only defining its streamability properties. The responsibility for devising a correct streaming implementation of such expressions is thus left entirely to the implementor, as it should be. In addition, we only invoke this rule as a fallback if the expression would otherwise be non-streamable, which reduces the risk of introducing bugs. As an alternative to (b) we could inline the rules for motionless patterns: basically, the top-level predicates must be motionless and non-positional. We will obviously need to add explanations for the reader; much of the required material already exists. The new rules no longer apply to union expressions. But I think we've relaxed the rules for unions in 19.8.7.4 sufficiently that they no longer need special treatment. Under the above rules, section//(author|publisher) is not streamable because the expression is not a "scanning expression". I think we can live with this. -- You are receiving this mail because: You are the QA Contact for the bug.
Received on Friday, 28 March 2014 08:59:30 UTC