Function identity #520
Labels
Enhancement
A change or improvement to an existing feature
XDM
An issue related to the XPath Data Model
XPath
An issue related to XPath
To make deep-equal error-free for all arguments (issue #333), and to support the introduction of sets (issue #34), we need to be able to test whether two functions are "the same function". This is a proposed pragmatic solution.
We change the data model for functions so that functions, like nodes, have an identity that is acquired when the function is created; two functions are identical if and only if they have the same identity.
In general any expression that returns a new function allocates it an identity that is different from all other existing functions (as with nodes). However:
contains(?, 'xxx')
appears in a loop, the expression can be lifted out of the loop so there is no requirement that it returns different functions each time (as there is with nodes)Benefits of this approach:
This does mean that expressions that return functions become a little impure - but only in the same way that expressions that create nodes are a little impure. The impurity is well understood and tolerated.
Maps and arrays do not have identity as a property separate from their content.
The text was updated successfully, but these errors were encountered: