Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Focus for RHS of thin arrow expressions #367

Closed
michaelhkay opened this issue Feb 21, 2023 · 2 comments
Closed

Focus for RHS of thin arrow expressions #367

michaelhkay opened this issue Feb 21, 2023 · 2 comments
Labels
Editorial Minor typos, wording clarifications, example fixes, etc. XPath An issue related to XPath

Comments

@michaelhkay
Copy link
Contributor

michaelhkay commented Feb 21, 2023

We define A -> F(B, C) as being equivalent to A ! F(., B, C) which means that B and C are evaluated with a focus based on the current item in A, not with the outer focus. This is different from the => operator. For example if the $E is an element E, with several children called F, then

namespace-uri(.) -> fn:QName(name())

has a different effect from

namespace-uri(.) => fn:QName(name())

whereas it might reasonably be expected that in the case where the LHS produces a single value, the two operators are equivalent. We can't change the meaning of => because it's defined in 3.1. So should we change the meaning of -> to fall into line?

We could do this easily enough by defining A -> F(B, C) as equivalent to for $a in A return F($a, B, C). I think that as well as being more consistent with =>, the result is probably more intuitive. (We could also define it as equivalent to let $f := F(?, B, C) return A ! $f(.))

For the expression A -> {B}, and for the proposed A => {B}, I don't think we have any choice other than evaluating B with an inner focus based on A. But at least we can do it consistently for both operators.

@ChristianGruen
Copy link
Contributor

A good observation! I fully agree, the for loop is more plausible.

@ChristianGruen ChristianGruen added XPath An issue related to XPath Clarification labels Feb 21, 2023
@ChristianGruen ChristianGruen added Editorial Minor typos, wording clarifications, example fixes, etc. and removed Clarification labels Apr 27, 2023
@michaelhkay
Copy link
Contributor Author

This change has been implemented as a consequence of the revamp of -> to =!>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Editorial Minor typos, wording clarifications, example fixes, etc. XPath An issue related to XPath
Projects
None yet
Development

No branches or pull requests

2 participants