generated from tc39/template-for-proposals
-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
The Stage 2 slides should include examples of prior art. I'll list some here. CC @eemeli @jessealama
Language | Name and Docs Link | Status | Shape | Unit/Currency | Features |
---|---|---|---|---|---|
F# | Units of Measure | Core language feature | In syntax, numeric types can be annotated with a Measure , such as 1.0<cm> |
Both | Math, Conversion |
Swift | Measurement | Standard Library (Foundation) | Immutable struct associating number with statically-typed quantity | Units Only* | Math, Conversion |
Java | Quantity | JSR 385, Standard Library Extension (javax) | Class associating a number with a unit | Units Only* | Math, Conversion |
JavaScript | Unit | Math.js, a popular package for working with numbers | An object with fields unit (like "meter"), dimension (a bitmask encoding something like "length"), and an optional value |
Units Only | Math, Conversion |
C++ | quantity | Boost, a popular standard library extension package | Class associating a unit with a value | Units Only* | Math, Conversion |
C# | IQuantity | UnitsNet, a popular package for units | Interface with many concrete impls associating number with quantity | Units Only* | Math, Conversion, I18n |
Python | Quantity | Pint, a popular package for units | Class associating number with units; runtime exceptions for incompatible conversions | Both** | Math, Conversion |
Java | Money | Joda Money, a popular package for currency | Class associating a BigDecimal with a currency | Currency Only | Math, Conversion***, I18n |
* These libraries export public classes/interfaces/traits which could be used to implement arbitrary units or currencies.
** Units are dynamic runtime values and it appears that they can be anything.
*** Conversion requires the user to provide the conversion rate
The above list should be enough, but there are also popular packages with these types in Rust (uom), Ruby (ruby-units),
Metadata
Metadata
Assignees
Labels
No labels