Functions with optional parameters

I've committed a PR ("variadicity") that revises the specs to allow:

(a) function declarations in XQuery and XSLT where some parameters are declared as optional with a default value. The default value is any expression and it is evaluated in the dynamic context of the caller.

(b) static function calls (including partial function application) able to supply arguments using keywords instead of positionally

I think this works reasonably cleanly and there are no major technical issues raised. There are probably a few loose ends such as the function-lookup() and load-xquery-module() functions.


Perhaps this is an opportunity for Norm to work out how best to present the changes for people to review...



Please review this carefully, and check the following sections in particular:

XQuery

2.1.1 Static Context, especially "Declared Functions"

2.1.2 Dynamic Context, especially "Named Functions"

4.4 Functions, especially 4.4.1, 4.4.2, 

5.18 Function Declarations

XSLT

3.5.3.3 Overriding Components from a Used Package

10.3 Stylesheet Functions (10.3.1 to 10.3.4)

Michael Kay

Received on Thursday, 29 September 2022 20:32:13 UTC