Re: Function naming: Problems and proposed solution

On Sat, 28 Nov 2020 at 15:47, Michael Kay <mike@saxonica.com> wrote:

> Another notion I've been toying with is that some atomic types like
> `QName`, `dateTime`, `duration`, `URI` should be coercible to maps and
> should therefore support a "?" operator, so you can do
> `current-date()?year` or `node-name(x)?local` or `uri?scheme`.
>

Question: Is the general case, 'obtain some part of' these atomic types?



>
> Extending this, the thing after "?" might be a function so you get the
> potential, for example, for "abc"?characters() returning ("a", "b", "c"),
> which avoids creating an fn:characters() function in global namespace.
>
> But then people might imagine that you can do $map?put('x', 3) which of
> course doesn't work.
>

IMHO the idea of a map doesn't map (sorry) easily to this 'some part of'?



>
> But perhaps this can be blended with the idea of refining the arrow
> operator; perhaps we make {current-date() => year()} work by defining
> "year" as a function that is only present in the static context of the RHS
> of the arrow operator when the static type of the LHS is union(xs:date,
> xs:dateTime)?
>
>
Re-using the 'some part of' (subset?)

current-date().year() seems quite readable?

How would that sit with Saxon Mike?


regards


-- 
Dave Pawson
XSLT XSL-FO FAQ.
Docbook FAQ.

Received on Saturday, 28 November 2020 16:15:41 UTC