[Bug 7350] [XPath 2.1] Higher Order Functions Need Sugar

http://www.w3.org/Bugs/Public/show_bug.cgi?id=7350





--- Comment #1 from Michael Kay <mike@saxonica.com>  2009-08-16 22:50:10 ---
Some comments on the proposed changes to the facility.

(1) Referring to function items without specifying the arity.

I'm sympathetic to the statement that it's a burden for users to have to
specify the arity.

However, the proposed solution whereby current-date() becomes a function item,
and the function call has to be written current-date(#void) is clearly a
non-starter for both backwards compatibility and usability reasons.

It might be possible to allow the arity to be omitted in the case where there
is only one function in the static context with a given QName. The function
item literal might then be written, say current-date##. However, this lacks
resilience to change: if the WG were to introduce a 1-argument version of
current-date() in a future release, the reference to current-date## (or any
other syntax that omitted the arity) would become invalid. One could defend
against that by making current-date## refer to the version of the function with
lowest arity. But I'm not convinced this is a good idea.

The proposal to introduce aliases for function names seems to me to introduce
more complexity where the aim should be to have less.

(2) Allowing reference to functions in the op: namespace.

I have some sympathy with the proposal. For coherence, I think it would require
making all the op: functions into standard user-visible functions.

(3) Partial application of more than one argument.

Again I think there is some merit in the proposal. I don't think underscore
works as a placeholder, because it is a valid NCName; I would suggest
question-mark instead. So you get for example

let $max_de := max(?, 'http://my-collation/de')

Interestingly this means that concat#2 can now be written instead as
concat(?,?), which seems to obviate the need for function literals in all cases
except 0-argument functions. I think we would need some special ad-hoc syntax
for that case.


-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Sunday, 16 August 2009 22:50:20 UTC