Re: [XQuery 3.1] clarification required on arrow postfix behavior

I have raised this as a bug:

https://www.w3.org/Bugs/Public/show_bug.cgi?id=27537


Michael Kay
Saxonica
mike@saxonica.com
+44 (0) 118 946 5893




On 5 Dec 2014, at 15:04, Biró D. Botond <botond23@gmail.com> wrote:

> Dear All,
> 
> What is the expected behavior if the arrow postfix operator is applied to a sequence containing more than one item?
> 
> Does the semantic equivalence "$seq=>$f(…) is the same as $f( $seq, … )" also hold when count($seq) != 1?
> ex, ( 1, 2, 3 ) => avg() or ()=>count()
> 
> In the last call working draft the wording for arrow postfix definition implies that a [single] item is expected, but don’t see why or if this restriction would be necessary.
> 
> “[Definition: An arrow operator is a postfix operator that applies a function to an item, using the item as the first argument to the function.] If $i is an item and f() is a function, then $i=>f() is equivalent to f($i), and $i=>f($j) is equivalent to f($i, $j).”
> 
> If the single restriction doesn't apply, then I suggest modifying the definition to reflect this. 
> 
> And a question related to operator precedence: currently it is not possible to use a node selection on the lhs of an arrow operator without wrapping it with extra parenthesis:
> $DAYS//@From => max() - syntax error
> ($DAYS//@From) => max() - ok
> is it planned for the arrow operator to be moved above the step expression(i.e. get lower precedence) so that one can use a node selection => without the need of the extra parenthesis?
> 
> Best regards,
> Botond Biró

Received on Monday, 8 December 2014 16:28:42 UTC