[Bug 29701] New: [XP31] editorial fixes for 3.1.5.1 Evaluating Static and Dynamic Function Calls

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

            Bug ID: 29701
           Summary: [XP31] editorial fixes for 3.1.5.1 Evaluating Static
                    and Dynamic Function Calls
           Product: XPath / XQuery / XSLT
           Version: Candidate Recommendation
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: editorial
          Priority: P2
         Component: XPath 3.1
          Assignee: jonathan.robie@gmail.com
          Reporter: abel.braaksma@xs4all.nl
        QA Contact: public-qt-comments@w3.org
  Target Milestone: ---

After the resolution of Bug 29277, some editorial errors crept in. Raising this
as a separate bug as I think this is purely editorial and the related bug has
already been sufficiently fixed.

Bug marked editorial.

1) In in 3.1.5.1, list item 5.b.ii starts with "Otherwise". I think the
"Otherwise" should be the last in the list. So either this item moves to
5.b.iii, or we remove it here and add it to the current 5.b.iii.

2) In in 3.1.5.1, list item 5.b.iii we say:

"If F's implementation is implementation-dependent not an XQuery 3.1
expression" 

I think this is meant to say:

"If F's implementation is implementation-dependent, that is, it is not an
XQuery 3.1 expression" 

3) We say in two occasions "or a partial application of such a function". I
find this confusing with the term "partial function application". Though it is
hyperlinked, I propose to change the wording to "or a partially applied
function", which I experience as more confirmatory, and re-using the definition
term seems appropriate here.

4) Examples were added (result of ACTION A-640-04 and Bug 29277 comment #20),
but an example that shows the reason that issue was raised (assigning or not of
the context item) is absent. 

I propose to add one for PFA and one for 5.b.ii, with a little explanation:

<proposal>
Example: using the context item in anonymous functions

The following example will throw a dynamic error XPDY0002

    let $vat := function() { @vat + @price }
    return shop/article/$vat()

To resolve this, you can either bind the context to a local variable or add an
argument to the anonymous function signature:

    let $ctx := shop/article,
    $vat := function() { for $a in $ctx return $a/@vat + $a/@price }
    return $vat()

Or:

    let $vat := function($art) { $art/@vat + $art/@price }
    return shop/article/$vat(.)

Example: partial function application of an anonymous function

Using a partial function application, you can bind the context to the
function's closure:

     let $vat := 
        function($art, $perc) 
        { for $p in $art/@price return $p div 100 * $perc },
     $vatfn := $vat(shop/article, ?)
     return $vatfn(21)
</proposal>

I tested above examples and I believe they are correct with the current rules
of this section ;).

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Tuesday, 21 June 2016 14:37:58 UTC