Re: ACTION-2029 - Check that integer promotes successfully to double

Erik,

Isn’t for the input parameter value of NaN returning an empty sequence not quite close to an empty string? When the sequence is converted to a string it will be an empty string. And in a lot of cases we convert to string in XForms. There are of course cases where there will be a difference. But I think that the advantages of returning an xs:date (or xs:dateTime) overweigh the impact of the backwards incompatibility.

Regards,

Nick Van den Bleeken

From: <ebruchez@gmail.com<mailto:ebruchez@gmail.com>> on behalf of Erik Bruchez
Date: Wednesday 2 September 2015 06:49
To: Public Forms, "public-xformsusers@w3.org<mailto:public-xformsusers@w3.org>"
Subject: ACTION-2029 - Check that integer promotes successfully to double
Resent-From: <public-xformsusers@w3.org<mailto:public-xformsusers@w3.org>>
Resent-Date: Wednesday 2 September 2015 06:50

All,

This is the case AFAICT, for example, in XPath 2.0:

    fn:substring(
        $sourceString as xs:string?,
        $startingLoc as xs:double
    ) as xs:string

    fn:substring(
        $sourceString as xs:string?,
        $startingLoc as xs:double,
        $length as xs:double
    ) as xs:string

I assume that, for compatibility with XPath 1.0, these functions take `xs:double` parameters. I checked that, with Saxon at least, passing an `xs:integer` works, as we had suspected was the case based on the spec, namely:

- you can pass an `xs:decimal` to an `xs:double`, possibly with loss of precision
- `xs:integer` is a subtype of `xs:decimal`
- therefore you can pass an `xs:integer` to an `xs:double`

This means that the following XForms functions can take `xs:double`:

- `days-to-date()` [1]
- `seconds-to-dateTime()` [2]

and so I fixed the types in the spec:

    https://www.w3.org/MarkUp/Forms/wiki/index.php?title=XPath_Expressions_Module&diff=4211&oldid=4209


Doing so, I have found another issue in these two functions, namely the following language from XForms 1.1:

> An input parameter value of NaN results in output of the empty string.

With the change to `xs:double`, the function parameters are now backward-compatible. But the return types are not: in XForms 1.1, they were `string`, and here they are `xs:date` or `xs:dateTime`.

We can either:

1. Change back the return types to `xs:string`, which is compatible with XForms 1.1, but not XPath 2.0-friendly,
2. or use `xs:date?` and `xs:dateTime?` return types. A `NaN` parameter returns the empty sequence.

-Erik

[1] https://www.w3.org/MarkUp/Forms/wiki/XPath_Expressions_Module#The_days-to-date.28.29_Function


[2] https://www.w3.org/MarkUp/Forms/wiki/XPath_Expressions_Module#The_seconds-to-dateTime.28.29_Function

Received on Friday, 11 September 2015 13:16:02 UTC