> On 2 Dec 2020, at 09:58, Tom Hillman <tom@expertml.com> wrote:
>
> I see more and more functions taking an options map as the final argument...
>
And perhaps that could be formalised into the language syntax so instead of
serialize($x, map{'method':'json', 'indent':true()})
you can write
serialize($x, method: 'json', indent: true())
Specifically, any keyword: value pairs in the function call are gathered together into a map, which is supplied as the last argument of the call, and the above call is treated as a call on the arity=2 function because there are one-or-more keyword:value arguments supplied.
I write calls like that a lot in xsl:message for debugging, and simplifying the syntax would be a very useful convenience.
If the function signature declares the options parameter as a record type rather than a general map type then it also gives you the opportunity for static checking that the option names are right.
Michael Kay
Saxonica