Re: Propose to accept PR #449

> 
> I wonder whether map:pairs() could return not just a loosest-possible
> record but, in the case of a typed map, a record of the appropriate
> type?
> 
> E.g. for a map declared as
>  map(xs:string, xs:double)
> map:pairs() ought to yield record sof type (xs:string, xs:double).
> 
> But in 18 i see,
> A ·key-value pair map· is an instance of the type record(key as
> xs:anyAtomicType, value as item()*).
> 

The values it returns will indeed be instances of the type record(key as xs:string, value as xs:double), but we have no way of capturing that in the type signature, any more than we can capture that subsequence() applied to xs:integer+ returns a value of type xs:integer*. That kind of inference is left to the implementation. 

The actual type of the values returned is of course a subtype of the type declared in the type signature.

Michael Kay
Saxonica

Received on Tuesday, 25 April 2023 07:55:26 UTC