Re: Arrow operator and ParenthesizedExpr

> On Sep 10, 2015, at 8:28 AM, Michael Kay <mike@saxonica.com> wrote:
> 
>  I’ve always read it as a kind of macro: (A => f(X, Y)) is translated during expression parsing to f(A, X, Y).

Me too. So Abel’s example:

> let $a := concat('hello', ?)
> let $b := concat('world', ?)
> return "!" => ($a, $b)()


Is equivalent to:

   … return ($a, $b)(“!”)

And would raise an error:

    "If FC is a dynamic function call: FC's base expression is evaluated with respect to SC and DC. If this yields a sequence consisting of a single function with the same arity as the arity of the ArgumentList, let F denote that function. Otherwise, a type error is raised [err:XPTY0004]."


> I think it would be clearer to specify it by means of a syntactic transformation:
> 
> Given a UnaryExpr U, an ArrowFunctionSpecifier F, and a ArgumentList (A, B, C…), the expression U => F(A, B, C…) is equivalent to the expression F(U, A, B, C…)
> 

Makes sense.

> “If $s is a sequence and f() is a function”. Are we talking about expressions, or about the values of expressions?


I like these examples though.  Maybe this description of $s and f() isn’t even necessary.  It could just say:

    “For example, $s=>f() is equivalent to f($s), and $s=>f($j) is equivalent to f($s, $j)."

Thanks,
Josh

Received on Thursday, 10 September 2015 15:53:55 UTC