Statically known function signatures versus Named Functions

I'm wondering if anyone can enlighten me about this detail in the XQuery/XPath spec.

The static context includes a component called "statically known function signatures", while the dynamic context includes a component called "named functions".

Now I would have expected that static references to function names (in function calls and function references) would look in the static context, while dynamic references (in function-lookup) would look in the dynamic context. I do remember a discussion as to why the two sets of functions might be different - there might be external functions discoverable at run-time that are not present in the compile time context.

But the surprising thing is that static function calls and named function references actually look up a function in the dynamic context (and raise a static error if the name is not found!). This feels all wrong to me. Can anyone explain it?

The problem is, I need to change this text to allow for variadic functions, and I don't want to miss some rationale behind the way it's currently described.

Michael Kay

Received on Wednesday, 28 September 2022 19:09:19 UTC