amazon-ion / ion-rust

Rust implementation of Amazon Ion
Apache License 2.0
148 stars 35 forks source link

Functions in Decimal and Coefficient with misleading behavior #433

Open rmarrowstone opened 2 years ago

rmarrowstone commented 2 years ago

There are two crate-visible functions in Decimal and Coefficient that are used for timestamps.

To support that there are two functions which work fine for their current purposes but have surprising semantics on their own:

rmarrowstone commented 2 years ago

An observation is that the TimestampBuilder could be refactored to take the components of the Decimal for fractional seconds. This would preserve the invariants such that the Text parser and DOM instantiation code couldn't get a runtime error. The binary parser is where the invariants needs to be checked at runtime, but we can put the checks there on the raw values that make up the Decimal.

zslayton commented 1 year ago

The methods mentioned are not public, so I don't think this needs to block 1.0.