Re: "anonymous function"

I think it would be very confusing to use the term "anonymous function" to mean anything other than "a function whose name property is absent". Inline functions are not the only kind of function with no name: other functions with no name include maps and arrays; the result of fn:random-number-generator()?next(); and the result of a partial function application.

The sentence we have in the CR is fine:

[Definition: An inline function expression creates an anonymous functionDM31 defined directly in the inline function expression itself.] (*)

but it's quite wrong to extrapolate this and suggest that ALL anonymous functions are the result of evaluating inline function expressions.

It also feels quite wrong that the semantics of a (dynamic) function call should depend on whether or not the function has a name. Why should that make any difference? Do we really want to treat my:f(?) differently from my:f#1?

Michael Kay

(*) well, its use of the term "anonymous function" is fine. The phrase "defined directly in the inline function expression itself" is pretty ghastly.

> On 1 Mar 2016, at 20:17, Michael Dyck <> wrote:
> At today's meeting, Michael Sperberg-McQueen wondered whether we used the term "anonymous function" elsewhere in our suite of specs. We do.
> The XQuery 3.0 requirements say:
>    "XQuery 3.0 MAY also provide the ability to define anonymous functions
>    e.g., lambda expressions."
> F+O 3.0 and 3.1 use it (in the description of 'function-name') to mean a function that isn't a "named function". I don't think it defines the latter term, but I gather it means a function whose 'name' property isn't absent.
> And so an anonymous function is (here) just one whose 'name' *is* absent.
> F+O also says that "a map is an anonymous function".
> XSLT 3.0 says, in an example, that the type pattern
>    ~function(*)[empty(function-name(.))]
> matches any function item that refers to an anonymous function.
> Serialization 3.1 says:
>    "In many cases the serialization of an item conforms to the syntax of
>    an XQuery expression whose result is that item. There are exceptions,
>    however: for example the syntax will not be valid XQuery in the
>    case of ... anonymous functions; ..."
> -Michael

Received on Tuesday, 1 March 2016 21:08:42 UTC