[Bug 29346] [XP31] XPath-style currying, or the arrow operator, may require a bit more specification

https://www.w3.org/Bugs/Public/show_bug.cgi?id=29346

--- Comment #7 from Michael Kay <mike@saxonica.com> ---
Your current proposal makes:

a => concat('b', ?, 'd') resolve to: concat(a, 'b', ?, 'd')

Correct

while it will make: a => (concat('b', ?, 'd'))() resolve to: concat('b', a,
'd')

I wouldn't say it "resolves" to that, but yes, it's equivalent to that.

and it will make the following illegal:

a => concat('b', ?, 'd')()

Yes, because (a => concat('b', ?, 'c')) evaluates to a function of arity 1, so
the argument list must have length 1. Why is this a problem?

>I can't think of a use-case why it is handy to treat an arrow expr with an argument
list with a placeholder as returning a function that takes one or more
arguments.

The general principle of orthogonality in language design is that you don't
introduce restrictions and exceptions to prevent something working just because
you can't think of a use case. There's no use case for using a function literal
in a dynamic function call (as in round#1(93.7)) but we allow it for
orthogonality reasons.

I don't think we need to allow the combination of "=>" and "?" in the same
expression but there is also no justification to disallow it.

>The first ArgumentPlaceHolder in FA is now replaced by A and evaluated as
described in 3.1.5.1.

I think that would be a poor design even if we were rethinking the design from
scratch. But as it's attempting to add a feature after going to a second CR,
and the feature is only cosmetic, I think it's impossible to justify.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Friday, 18 December 2015 12:42:10 UTC