-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
Unsigned
integers should be printed as hexadecimal
#46
Comments
One interesting question here is whether we should preserve type differences stemming from how integer values are formatted. The TOML spec doesn't say much about what types should be used to represent values, merely that
That means that while we should parse hex literals (and binary and octal), we could still represent the values using |
As Stefan showed, 64-bit integers should be handled losslessly (which the current parser does) so I would say it is within spec. There's been some discussion about this: |
Since it's within the bounds of the spec, I'd certainly be in favor of using larger types to faithfully represent integer values larger than the range of
Option 1 is simpler, but I feel like option 2 makes TOML more useful for Julia usage where that type information can be useful. Changing the type used to represent hex/octal/binary literals is technically a breaking change, but I doubt it would cause much trouble. |
I second @StefanKarpinski 's option 2 - if we don't do it, the current way is to write them as strings and parse to a Julia type anyway, I'd rather let it be handled by the parser directly. FYI. I bring this issue up mainly because it fails to serialize the random number generator seed in |
I definitely feel that for Julia being able to store integer values of arbitrary size in TOML files is a good idea. Of course, other TOML implementations might not be able to read them, but that's ok. |
Currently, everything is converted to
Int64
, but this has a fundamental incompatibility with unsigned integers, and this is not consistent with the original TOML specification, e.gthe following TOML file should be valid according to the specification, but the Julia parser fails to parse or print
The text was updated successfully, but these errors were encountered: