Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adaptive serialization: doubles #1618

Open
ChristianGruen opened this issue Nov 28, 2024 · 2 comments
Open

Adaptive serialization: doubles #1618

ChristianGruen opened this issue Nov 28, 2024 · 2 comments
Labels
Enhancement A change or improvement to an existing feature Serialization An issue related to the Serialization spec

Comments

@ChristianGruen
Copy link
Contributor

ChristianGruen commented Nov 28, 2024

We should make the serialization spec more liberal when it comes to the representation of double values. The prescribed output format is format-number(?, '0.0##########################e0'), which is very strict and often confusing when maps and arrays are serialized. Maps resulting from JSON conversions often contain doubles without users noticing it (related: #1583).

We should make the behavior implementation-dependent or align it with the serialization of JSON data (without losing its additional features to e.g. serialize function items or sequences). Backward compliance shouldn’t be an important issue, as the method was mainly introduced for debugging purposes.

@ChristianGruen ChristianGruen added Enhancement A change or improvement to an existing feature Serialization An issue related to the Serialization spec labels Nov 28, 2024
@michaelhkay
Copy link
Contributor

The idea was that, because the method is there for debugging purposes, you should be alerted to the fact that the values are floating point.

@ChristianGruen
Copy link
Contributor Author

The idea was that, because the method is there for debugging purposes, you should be alerted to the fact that the values are floating point.

It is not quite clear me why there is a special rule for doubles, but not for other types (when 1 is output, the item might have been an integer, a byte, a decimal or a text node. "a" could have been a string or a URI, and so on).

One argument for being more liberal could be that this is a debugging feature, and we have not formalized the output of fn:trace or $err:stack-trace either. Maybe we should even allow processors to output items as xs:double(‘1234‘), xs:byte('1'), and so on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement A change or improvement to an existing feature Serialization An issue related to the Serialization spec
Projects
None yet
Development

No branches or pull requests

2 participants