This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 29858 - [XP31] Named Function References - context information
Summary: [XP31] Named Function References - context information
Status: RESOLVED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XPath 3.1 (show other bugs)
Version: Candidate Recommendation
Hardware: PC All
: P2 minor
Target Milestone: ---
Assignee: Josh Spiegel
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-22 12:01 UTC by Michael Kay
Modified: 2016-11-04 20:31 UTC (History)
2 users (show)

See Also:


Attachments

Description Michael Kay 2016-09-22 12:01:52 UTC
In 3.1.6 it is written:

Furthermore, if the function referenced by a NamedFunctionRef has an implementation-dependent implementation, then the implementation of the function returned by the NamedFunctionRef is associated with the static context of this NamedFunctionRef expression and to the dynamic context in which it is currently being evaluated.

Two editorial problems here:

(a) I don't think any distinction is intended between "associated with" and "associated to". XDM says that a function implementation is optionally "associated with" a static and dynamic context.

(b) It's not clear what the referent of the final "it" is (and the ambiguity here is dangerous).

I think there's a slightly deeper problem, and it lies in the definition "A named function reference denotes a named function." Well, it doesn't - it is an expression which is evaluated to return a "function" in the XDM sense; this function will have a name, but it will also have other properties, and those properties are not simply the properties of the function as found in the static context.

So I suggest

(i) Change the definition to

[Definition: A named function reference is an expression that evaluates to a function. The name and arity of the function reference must correspond to a function signature found in the static context of the expression and to a function found in the *function names* component of the dynamic context.] 

To uniquely identify a particular named function, both its name as an expanded QName and its arity are required.

Delete: [Definition: A named function is a function defined in the static context for the expression.]

(ii) Change the above para to:

Furthermore, if the function returned by the evaluation of a NamedFunctionRef has an implementation-dependent implementation, then the implementation of this function is associated with the static context of this NamedFunctionRef expression and with the dynamic context in which the NamedFunctionRef is evaluated.
Comment 1 Michael Dyck 2016-09-22 16:35:49 UTC
Two things, both picky:

(1)
"[Definition: A named function reference is an expression that evaluates to a function."

While that statement is true, there are other expressions that evaluate to a function, so it isn't very good as a definition of 'named function reference'. To get a statement that's true *only* for named function references, we could add something like "by literally specifying the function's name and arity". (Though it sounds a bit clunky.)

Really, a named function reference is, by definition, just an instance of the NamedFunctionRef nonterminal. If we were more willing to use nonterminals in prose, "named function reference" wouldn't even need to exist as a term.


(2)
"The name and arity of the function reference must correspond to a function signature found in the static context of the expression and to a function found in the *function names* component of the dynamic context.]"

That's a normative requirement, which we don't usually put into definitions. (Skimming through the glossary, I see that the definitions of 'encoding declaration' and 'zero-digit' also contain requirements.)
Comment 2 Michael Kay 2016-09-26 22:40:44 UTC
Another attempt at a definition:

A named function reference is an expression which evaluates to a named function. The name and arity of the returned function are known statically, and correspond to a function signature present in the static context; if the function is context dependent, then the returned function is associated with the static context of the named function reference and the dynamic context in which it is evaluated.
Comment 3 Josh Spiegel 2016-11-04 20:31:02 UTC
Applied suggested changes.