-
Notifications
You must be signed in to change notification settings - Fork 322
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
Issue 493 - First draft of data type description #495
Conversation
docs/data_types.md
Outdated
| --------- | --------------------------------------------------------- | ---------------- | ------------------ | | ||
| string | unlimited | string | | | ||
| number | ±2.23×10^308 to ±1.80×10^308 (IEEE 64-bit floating point) | number | | | ||
| long | (-2^53 + 1) - (2^53 + 1) (54-bit signed integer\*) | integer | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this not be a true 64 bit long? It's only javascript that is constrained right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For interoperability with Javascript, we have to define it within the constraints of what Javascript environments can support, which is the 54-bit signed range.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we agreed in another thread to not do that - and instead leave it full 64bits, but consider that some implementations can't handle that...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lrosenthol, are you saying that we should just call the range as 64-bit, leave the note that that in practice its only 53-bit?
I feel like we should just acknowledge the limitation here. The JSON/Javascript ecosystem only really supports a 54-bit integer. We want to interop with JS, so we adopt the same.
docs/data_types.md
Outdated
| --------- | --------------------------------------------------------- | ---------------- | ------------------ | | ||
| string | unlimited | string | | | ||
| number | ±2.23×10^308 to ±1.80×10^308 (IEEE 64-bit floating point) | number | | | ||
| long | (-2^53 + 1) - (2^53 + 1) (54-bit signed integer\*) | integer | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we agreed in another thread to not do that - and instead leave it full 64bits, but consider that some implementations can't handle that...
docs/data_types.md
Outdated
| short | -2^15 - 2^15 (16-bit signed integer) | integer | | | ||
| byte | -2^7 - 2^7 (8-bit signed integer) | integer | | | ||
| boolean | { true, false } | boolean | | | ||
| date | n/a | string | date | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should put references to 3339 or 8601 on the various dates
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fixed in the latest commit
docs/data_types.md
Outdated
| date | n/a | string | date | | ||
| date-time | n/a | string | date-time | | ||
| array | n/a | array | | | ||
| object | n/a | object | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you really mean object here or is this the "map" that you want?
@lrosenthol @kstreeter - I vote for the max being Number.MAX_SAFE_INTEGER ((2^53)-1) My thinking: JSON-LD is built on JSON-Schema which is built on JavaScript. The latter has the 53-bit Number limit ((2^53)-1).
Thus to my mind our long needs to be limited to Number.MAX_SAFE_INTEGER. We have to accept that baggage or else say XDM is a special case, which we will end up having to repeat in perpetuity. I know it sucks, but we need to hold to consistency. If you need really big numbers, they need to be string encoded. |
docs/data_types.md
Outdated
| --------- | --------------------------------------------------------- | ---------------- | ------------------ | | ||
| string | unlimited | string | | | ||
| number | ±2.23×10^308 to ±1.80×10^308 (IEEE 64-bit floating point) | number | | | ||
| long | (-2^53 + 1) - (2^53 + 1) (54-bit signed integer\*) | integer | | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kstreeter That range seems wrong to me, should it not be:
-(2^53 - 1) to (2^53 - 1) (54-bit signed integer*)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an error here @cdegroot-adobe, although the range you suggested is not correct either. From RFC 8259 section 6:
Note that when such software is used, numbers that are integers and
are in the range [-(2**53)+1, (2**53)-1] are interoperable in the
sense that implementations will agree exactly on their numeric
values.
@cdegroot-adobe - we have previously agreed that while the original JSON design (and the name) was built around JavaScript, neither JSON-LD nor JSON-Schema is built on JavaScript or its limitations. That said, provided that we can resolve the |
Fix the range for JSON integers
Thanks @lrosenthol. I filed issue #519 to track the need for BigDecimal/BigInteger types in XDM. |
This PR addresses #493 by defining the logical type model for XDM, and adding a new
meta:xdmType
attribute to the meta schema.