Re: Discussion of op:same-key

On 02/06/2016 11:31, Michael Kay wrote:
>
> Given
>
> let $a := <a size="3"/>
>
> let $m := map{ $a/@size+1, $a }
>
> people expect $m(4) to return the <a> element. We don't want them to have to start thinking about the fact that @size+1 is actually an xs:double rather than an integer.
>
On that basis, a user might also expect

let $result := map {
               xs:float(33554433): "no surprise"
             }
return $result?33554433

to return "no surprise", but instead the user will end up surprised, 
having been led astray by having seen this work for smaller integers.  
The rule "use a key of matching type" is one the user would learn early 
on.  Learning "beware the precision of floating point numbers" might 
take a little longer.

Cheers,
     Tim

Received on Thursday, 2 June 2016 12:00:17 UTC