xsl-list
[Top] [All Lists]

RE: [xsl] [XPath 3.0] Why should I bother specifying the "arity" of a function that I invoke?

2012-10-31 17:10:07
 concat#3 is an expression that returns a function item.

So is concat#3 equivalent to this partial function application:

     concat(?, ?, ?)

If yes, when is one preferred over the other?

/Roger

-----Original Message-----
From: Michael Kay [mailto:mike(_at_)saxonica(_dot_)com] 
Sent: Wednesday, October 31, 2012 5:54 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] [XPath 3.0] Why should I bother specifying the "arity" of a 
function that I invoke?


On 31/10/2012 21:06, Costello, Roger L. wrote:
Hi Folks,

The XPath 3.0 specification says that when a named function is invoked you 
should specify the number of arguments (i.e., the arity):

      NamedFunctionRef           ::=          EQName "#" IntegerLiteral

Here is an example:

      concat#3('Section', ': ', 1)

But this works just as well:

      concat('Section', ': ', 1)

So why should I bother specifying the arity? Is there a case where I *must* 
specify the arity?

concat#3 is an expression that returns a function item. You need it if 
you are going to store the function item in a variable, pass it to 
another function, return it from a function, or do other things that you 
can do with run-time values.

You don't need a run-time function item if you know statically what 
function to call and if the only thing you want to do is to call the 
function.

Michael Kay
Saxonica


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--