- From: Kay, Michael <Michael.Kay@softwareag.com>
- Date: Wed, 26 Nov 2003 09:40:15 +0100
- To: "'Panagiotis Reveliotis'" <prevelio@bea.com>, public-qt-comments@w3.org
- Message-ID: <DFF2AC9E3583D511A21F0008C7E62106073DD2E2@daemsg02.software-ag.de>
> 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 > I personally support this proposal, though the working group considered an identical proposal quite recently and rejected it, for reasons I do not fully understand. XSLT 2.0 does support overloading of functions by arity. I think that overloading by arity is very useful for writing a pair of recursive functions, and does not lead to any technical problems. (Incidentally, the "may not" in the quoted text should be "must not", and it's probably time we took out notes that speculate about future versions of XQuery). Michael Kay
Received on Wednesday, 26 November 2003 03:44:19 UTC