[Bug 10719] New: [XPath21] The text describing how function items are evaluated is not very precise

http://www.w3.org/Bugs/Public/show_bug.cgi?id=10719

           Summary: [XPath21] The text describing how function items are
                    evaluated is not very precise
           Product: XPath / XQuery / XSLT
           Version: Member-only Editors Drafts
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XPath 2.1
        AssignedTo: jonathan.robie@redhat.com
        ReportedBy: oliver@cbcl.co.uk
         QAContact: public-qt-comments@w3.org


This also applies to XQuery 1.1

Section 3.1.5.1 describes how functions are evaluated, and has the following
two rules:

3.  If $f is a function itemDM11, then the set of variable values from the
function item's closure are added to the dynamic context with a scope of the
invocation of the function.

5. (...) During evaluation of a function body, the static context and dynamic
context for expression evaluation are defined by the module or expression in
which the function is declared, which is not necessarily the same as the
context in which the function is called. (...)

I have a few issues with this text:

1.
On an editorial note, the $f in point 3 should be in a monospaced font.


2.
One reading of this text implies that the functions closure is added to the
current context, but then the dynamic context used is defined by where the
function item was declared, and so may not have these variables.


3.
If $f is a function item then it is not a built-in or user-defined function
(functions and function items are different things).  Thus the text never
actually says how to evaluate a function item.



It may be better to rewrite this section in two parts: The first part
explaining how a function is evaluated (mostly unchanged from XPath 2.0 /
XQuery 1.0).  The second part should say (roughly)

The result of a function call on a function item is computed in the same way as
the result of a call on the function described by the function, except that in
the case of a user-defined function the dynamic context used to evaluate the
function's body is augmented by the the set of variable values from the
function item's closure.

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Friday, 24 September 2010 12:52:36 UTC