-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
manual.yml: clarify and expand section on identity #2731
Conversation
Mostly clarifications w.r.t. numbers. The anomalous behavior of leading minus signs is documented, with an explicit notice that this will probably change.
Clarify that the effect of a leading minus sign only applies to numbers in a jq program.
fix two examples
We must not commit to number representations. RFC 8259 blessed -or cursed, depending on your viewpoint- JSON implementors with a great deal of latitude on internal (no limits here, as the RFC does not even envision tools like jq) and external JSON number representation. There is nothing like a canonical number representation. Any representation we choose, even a -in some cases- literal-preserving scheme like our current one could be obnoxious to some users. There is no right answer here, therefore we may not commit to even our current scheme. We must remain free to replace Moreover, we should not impose our number representation schemes on other implementations of the jq language. The implementors of those ought to at least get a say, and the easiest thing to do in that regard is to not even raise the issue. Any documentation regarding how jq supports numbers at this time must be explicit on this point. |
docs/content/manual/manual.yml
Outdated
processing can sometimes make it appear as though it does. | ||
In particular, the parsing of JSON numbers can alter their | ||
representation and even their value. For example, although | ||
jq will attempt to maintain the original decimal precision |
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.
s/will/may/
representation of the number. | ||
Also, any arithmetic operation on a number that has not | ||
already been converted to an IEEE754 double precision | ||
representation will trigger a conversion to the IEEE754 |
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.
s/will/may/
docs/content/manual/manual.yml
Outdated
Also, any arithmetic operation on a number that has not | ||
already been converted to an IEEE754 double precision | ||
representation will trigger a conversion to the IEEE754 | ||
representation. Currently, though this will probably change |
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.
Make this:
Currently, though this may change in the future, negative literals in jq programs may be converted to IEEE 754 doubles, with consequent loss in precision.
docs/content/manual/manual.yml
Outdated
|
||
jq will also try to maintain the original decimal precision of the provided | ||
number literal. See below for examples. | ||
Comparisons, however, are carried out using the untruncated |
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.
s/are/may be/
BTW, thank you for this @pkoppstein -- clearly we slipped up a bit in the docs when we accepted the |
@nicowilliams @emanuele6 - Thanks for all the corrections and suggestions. Please note that I've restructured the text with the intent of clearly identifying that which is subject to change, Please also note that with the revised version, "All checks have passed". As regards other implementations of jq: I agree it would be great to have a mutually agreed-upon definition of "standard jq", and clearly langjq serves as a kind of reference for other implementations. But manual.yml has not been written with buy-in from the authors of other implementations, and indeed both gojq and especially jaq deliberately depart from several key aspects of jq. Until there is some kind of agreement amongst the jq, gojq, and jaq authors/maintainers/communities That would also be helpful to the authors of other implementations, not least in the writing of their own documentation. |
Thank you! LGTM. I think on rebase-and-merge the merge commit will go away, but I strongly recommend doing |
@nicowilliams wrote:
Is this for future reference, or would you like me to do something regarding this particular PR? (If you want me to do something for this particular PR, I'd be inclined to delete it, and this branch, and start afresh. My git skills outside of GitHub Desktop are at best negligible.) |
@pkoppstein in the list of commits for this PR there's a merge commit. I don't know whether clicking the "Rebase and merge" button would make that merge commit go away, but I want it to. We should very much try to have "linear history" in jq, which means no merge commits. This gist might be useful to you. |
Mostly clarifications w.r.t. numbers.
The anomalous behavior of leading minus signs is documented, with an explicit notice that this will probably change.