review of "Evaluating Function Calls"

Jonathan asked me to review the current state of the XQuery/XPath spec with 
respect to function evaluation. Here are some thoughts.

Main ref is "Evaluating Static and Dynamic Function Calls":


In step 5, the change (at various points) from wording like:
     function implementation is [not] a FunctionBody
     function implementation is [not] an &language; expression
is not in sync with the "Inline Function Expressions" and "Function 
Declaration" sections, which still say that the resulting function's 
implementation is a FunctionBody. I'd be inclined to undo the change in, as I don't think it's an improvement.

Maps + Arrays:

Item 5.b.i says:
     If F is a map, it is evaluated as described in "Map Lookup
     using Function Call Syntax". If F is an array, it is evaluated as
     described in "Array Lookup using Function Call Syntax".
These two possibilities are disjoint, so maybe they should be separate points.

Because maps and arrays are functions, one can presumably perform partial 
function application on them (though I think it would not generally be 
useful). Is the resulting function a map/array? E.g., consider:
     let $m := map {"Su": "Sunday"} return ($m(?)) ? "Su"
Does the lookup return "Sunday", or does it raise a type error? I don't 
think gives a clear answer.

At the end of, I said:
> we need to be clearer about how arrays and maps fit into the world
> of functions. (That is, we need to say more in the sections on arrays
> and  maps, not just mention them in 5.b.ii's parenthetical list.)
What I had in mind was that the Arrays + Maps sections could specify the 
properties of the function that is defined, as do the sections on Function 
Decls and Inline Function Expressions. Which wouldn't necessarily answer the 
above question, but might get us closer.


Received on Monday, 18 April 2016 21:24:03 UTC