Skip to content

Integer and Decimal Type Renames for 2.0 #6144

Open
@younies

Description

@younies

Discussion: core decimal types

  • @sffc Did we want pub type UnsignedDecimal = WithDecimal<UnsignedInteger>? Decimal is an Integer with an extra field that specifies the location of the decimal point.
  • @robertbastian Yes, but it is extra work.
  • @sffc Is it breaking to change pub struct UnsignedDecimal to pub type UnsignedDecimal?
  • @robertbastian Maybe, not sure
  • @sffc If we keep fixed_decimal as a separate non-stable crate, this is fine, because the only thing we format is Decimal
  • @sffc Do we want the type wrap to be private? pub struct Decimal(Signed<UnsignedDecimal>)
  • @robertbastian That requires duplicating all the functions or derefing, and removing a deref step seems more semver breaking than the alternative

Proposal:

  1. Definitely in 2.0:
    • pub type Decimal = Signed<UnsignedDecimal>
    • pub struct UnsignedDecimal
  2. Additional integer renames (see point 3):
    • pub type Integer = Signed<UnsignedInteger>
    • pub struct UnsignedInteger
  3. If fixed_decimal remains a util crate, we can do the integer changes post-2.0, which may involve a range dependency from icu_decimal to fixed_decimal. If we merge it into icu_decimal, we put the integer types behing an experimental feature.
  4. If we can make pub type UnsignedDecimal in 2.x, great, if not, fine, maybe in 3.0

LGTM: @sffc @younies @robertbastian @echeran

Metadata

Metadata

Assignees

Labels

C-numbersComponent: Numbers, units, currencies

Type

Projects

Status

No status

Relationships

None yet

Development

No branches or pull requests

Issue actions