RE: Arrow operator and ParenthesizedExpr

Good catch.

I think it should be a type error if ArrowFunctionSpecifier evaluates to anything other than a single function.

Allowing a sequence of functions makes sense too, but there are other ways to get this functionality, I don't think that's what people have implemented, and it could add some complexity to the implementation.  It might also invite queries that are harder to read ...

Jonathan
________________________________________
From: Abel Braaksma [abel.braaksma@xs4all.nl]
Sent: Thursday, September 10, 2015 10:40 AM
To: Public Joint XSLT XQuery XPath
Subject: Arrow operator and ParenthesizedExpr

If I understand the syntax productions correctly, the following is legal:

let $a := concat('hello', ?)
let $b := concat('world', ?)
return "!" => ($a, $b)()

The spec only talks of "the function" with respect to the rhs of the expression. But here it is a sequence of expressions. Likewise, if the rhs sequence evaluates to the empty sequence, is the result the empty sequence?

If I were to interpret the above, assuming it is allowed, I'd say the output should be: ("hello!", "world!") (i.e., a sequence of two items, as a result of applying the arrow operator to each item in the sequence).

If this is indeed legal, perhaps we can change the text to read "An arrow operator applies a sequence of functions to the value of...". If it is not legal (but legal syntax), perhaps we can say it isn't, for instance by saying that the result of evaluating ArrowFunctionSpecifier must be one-and-only-one.

Cheers,
Abel



Received on Thursday, 10 September 2015 14:51:41 UTC