Skip to content

Reduce scope of Amount by avoiding unit conversion#29

Merged
jessealama merged 29 commits into
mainfrom
reduce-scope-for-amount
Jul 10, 2025
Merged

Reduce scope of Amount by avoiding unit conversion#29
jessealama merged 29 commits into
mainfrom
reduce-scope-for-amount

Conversation

@jessealama

@jessealama jessealama commented Jul 2, 2025

Copy link
Copy Markdown
Collaborator

In discussions among various TC39 delegates, it has become clear that the concept of a unit conversion brings up a number of challenges that can be cleanly separated from the more fundamental problem of representing a mathematical value, tagged with a unit, together with a precision. This is an important part of the notion of measurement that is a subset of the original motivation and argument for Measure. We propose to separate these challenges from those that come from supporting measurements, such as:

  • the need for unit conversion,
  • compound units (e.g., "foot-and-inch"),
  • arithmetic: involved in conversions (rationals? decimals? binary floats?),

etc.

In discussions among various TC39 delegates, it has become
clear that the concept of a unit brings up a number of
challenges that can be cleanly separated from the more
fundamental problem of representing mathematical values
together with a precision. This is an important part of the
notion of measurement that is a subset of the original
motivation and argument for Measure. We propose to separate
these challenges from those that come from supporting
measurements, such as:

* the need for unit conversion,
* compound units (e.g., "foot-and-inch"),
* whether: some units (and which ones?) should be
  included (SI?) out-of-the-box,
* user-customizable units,
* arithmetic: involved in conversions (rationals?  decimals?
  binary floats?),

etc.

@eemeli eemeli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Units and currencies must not be left out of Amount. Unit conversion and compound units can and should be left for later, but at least for me the primary purpose of Amount is for it to hold a numerical value together with an indicator of what it's an amount of.

It was an accident to drop them. They're supposed to be
there. But we do not intend to support unit conversion,
certainly, given the issues involved there.
@jessealama

Copy link
Copy Markdown
Collaborator Author

Units and currencies must not be left out of Amount. Unit conversion and compound units can and should be left for later, but at least for me the primary purpose of Amount is for it to hold a numerical value together with an indicator of what it's an amount of.

Indeed, this was a big mistake. Can you take another look? Units are, of course, supposed to be included.

@jessealama jessealama requested a review from eemeli July 3, 2025 11:51
@jessealama jessealama changed the title Focus scope on notion of unitless Amount Reduce scope of Amount by avoiding unit conversion Jul 3, 2025
Comment thread README.md Outdated
Comment thread README.md
Comment thread README.md
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md
jessealama and others added 17 commits July 4, 2025 10:13
Co-authored-by: Eemeli Aro <eemeli@gmail.com>
Co-authored-by: Eemeli Aro <eemeli@gmail.com>
Co-authored-by: Eemeli Aro <eemeli@gmail.com>
Co-authored-by: Eemeli Aro <eemeli@gmail.com>
Co-authored-by: Eemeli Aro <eemeli@gmail.com>
Co-authored-by: Eemeli Aro <eemeli@gmail.com>
Co-authored-by: Eemeli Aro <eemeli@gmail.com>
Co-authored-by: Eemeli Aro <eemeli@gmail.com>
Co-authored-by: Eemeli Aro <eemeli@gmail.com>
Co-authored-by: Eemeli Aro <eemeli@gmail.com>
Co-authored-by: Eemeli Aro <eemeli@gmail.com>
Co-authored-by: Eemeli Aro <eemeli@gmail.com>
@jessealama jessealama requested a review from eemeli July 4, 2025 08:40
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md
jessealama and others added 2 commits July 9, 2025 11:30
Co-authored-by: Eemeli Aro <eemeli@gmail.com>
@jessealama jessealama requested a review from eemeli July 10, 2025 08:23

@eemeli eemeli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One small nitpick/addition, otherwise looks good!

Comment thread README.md Outdated
Co-authored-by: Eemeli Aro <eemeli@gmail.com>
@jessealama jessealama merged commit bd4d297 into main Jul 10, 2025
2 checks passed
@jessealama jessealama deleted the reduce-scope-for-amount branch July 10, 2025 15:43
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.

3 participants