这是indexloc提供的服务,不要输入任何密码
Skip to content

Prior Art #43

@sffc

Description

@sffc

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions