https://saxonica.plan.io/https://saxonica.plan.io/favicon.ico2019-06-14T15:53:10ZSaxonica Developer CommunityW3C QT Specifications - Bug #4236: Note regarding streamability of fn:filterhttps://saxonica.plan.io/issues/4236?journal_id=136962019-06-14T15:53:10ZMichael Kaymike@saxonica.com
<ul></ul><p>Furthermore, the streamabililty profile for fn:filter is given as <code>fn:filter(N, I)</code> but I think it should be <code>fn:filter(T, I)</code>. The distinction doesn't really matter unless we get smarter about streamable higher-order functions.</p> W3C QT Specifications - Bug #4236: Note regarding streamability of fn:filterhttps://saxonica.plan.io/issues/4236?journal_id=136972019-06-14T16:20:29ZMichael Kaymike@saxonica.com
<ul></ul><p>Furthermore, the table in 19.8.9 lists fn:for-each and fn:for-each-pair without a reference to the sections in which they are explained more fully (19.8.9.10, 19.8.9.11).</p>
<p>I don't think that higher-order functions in general are correctly handled simply by applying the general streamability rules to the proforma. The supplied function argument is generally treated as an operand with usage=inspection, and supplying an argument value like function($x){$x/..//*} works just fine for an inspection argument (inline function declarations, as well as user function references, are grounded and motionless). It's when we invoke the function that we get a problem. The rule for fn:filter() should be that the first argument can be consuming/striding provided that the second argument is a call on a function with streamability="inspection".</p>
<p>We should really be using the function annotation mechanism for this. The streamability of a user-declared function should translate into an annotation on the function, and higher order functions should define constraints on the streamability annotation of the actual function supplied.</p> W3C QT Specifications - Bug #4236: Note regarding streamability of fn:filterhttps://saxonica.plan.io/issues/4236?journal_id=136992019-06-18T16:00:50ZMichael Kaymike@saxonica.com
<ul></ul><p>Note that for Saxon, I have now made <code>fn:filter()</code> streamable under particular conditions: the supplied predicate function must be statically known, and must be either (a) a reference to a user-declared stylesheet function with streamability="inspection", or (b) an anonymous inline function that satisfies the rules for streamability="inspection", that is, the function body must be grounded and motionless. The operand usage for the first argument is transmission (so if the first argument is striding and consuming, then so is the result).</p>