function overloading

XQuery 1.0: An XML Query Language 
states (section 4.12: Function Declaration):
"In XQuery 1.0, user-declared functions may not be overloaded. 
A user-declared function is uniquely identified by its expanded QName. 
...
Note:
If a future version of XQuery supports overloading of user-declared functions, 
an ambiguity may arise between a function that takes a node as parameter and
a function with the same name that takes an atomic value as parameter (since a
function call automatically extracts the atomic value of a node when necessary). "

Would it be possible to relax this rule and allow for function overloading based 
on the arity of the function parameters? (in other words, allow for ns:fn(a), ns:fn(a,b),
ns:fn(a,b,c)). Such an approach would not lead to ambiguities, as a function
would be uniquely identified by its expanded QName and the number of its 
arguments. At the same time some of the flexibility provided by overloading 
would remain at the hands of the users.

Cheers,
Panagiotis

Received on Tuesday, 25 November 2003 22:39:01 UTC