Skip to content

Conversation

ChristianSi
Copy link
Contributor

  • Replace the vague term "expected" with the RFC 2119-compatible terms "should", "must", "required"
  • Clarify that an error must be thrown if an integer cannot be represented losslessly

Fixes #736.

* Replace the vague term "expected" with the RFC 2119-compatible terms
  "should", "must", "required"
* Clarify that an error must be thrown if an integer cannot be represented
  losslessly
@ChristianSi ChristianSi changed the title Clarify what "expected" means Replace "expected" by more precise terms May 15, 2020
@eksortso
Copy link
Contributor

LGTM!

Copy link
Member

@pradyunsg pradyunsg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, barring one comment about simplifying the sentence about "integer too big for me" -> "error out".

README.md Outdated
Comment on lines 492 to 494
handled losslessly. If the result of parsing a value with unlimited precision
would result in an integer that cannot be represented losslessly, an error must
be thrown.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like a very complex sentence -- I understand what this means, but it needed a couple of readings and conscious thinking to figure it out.

I think we can drop the "unlimited precision" part of this sentence without losing any of the main benefits. :)

Suggested change
handled losslessly. If the result of parsing a value with unlimited precision
would result in an integer that cannot be represented losslessly, an error must
be thrown.
handled losslessly. If an integer that cannot be represented losslessly,
an error must be thrown.

Copy link
Contributor

@abelbraaksma abelbraaksma May 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pradyunsg I agree to an extend. Though as advocate for the devil, a very literal reading can then become: I parse an int with Int64.TryParse and get back -2. Fine, right?

Nope, because that function would give a 2's complement result, input could've been 2^63 + 2. Hence I introduced the wording "with unlimited precision".

I would highly recommend that at some point we diverge into two documents: one for the general public, and one being the actual spec using precise spec wording. The second one intended for implementers, who are expected to be able to read such more strict documents.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm... I'm pretty sure I'd consider 2^63 + 2 becoming -2 as a case of "cannot be represented losslessly".

I would highly recommend that at some point we diverge into two documents: one for the general public, and one being the actual spec using precise spec wording. The second one intended for implementers, who are expected to be able to read such more strict documents.

Perhaps? I understand the balance we're trying to strike here, and if it's definitely-not-possible, we should do this. I'm not convinced that it'd be a worthwhile exercise right now though. :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PS: I think the devil is pretty hunky-dory right now. It'll be fine if you don't advocate for them for a bit. :P

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not convinced that it'd be a worthwhile exercise right now though. :)

Agreed, I didn't mean "right now", but more for a vNext ;)

@ChristianSi
Copy link
Contributor Author

ChristianSi commented May 19, 2020

@pradyunsg Your suggestion was not quite clear, but I've just pushed a commit that (I think) fulfills it. Better now?

@abelbraaksma To me the rewritten sentence still sounds fairly unambiguous, though it's true that the old version was even more explicit.

@ChristianSi
Copy link
Contributor Author

What's the status of this? @pradyunsg Are you ready to merge?

@pradyunsg
Copy link
Member

I thought I had already!

@pradyunsg pradyunsg merged commit a3ff6f7 into toml-lang:master May 26, 2020
This was referenced Jun 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clarify what "expected" means
4 participants