Squants v0.4.2 Release Notes

Release Date: 2014-07-06 // over 9 years ago
  • ๐Ÿ‘Œ Improvements to Market
    • โž• Add Price.in method for directly converting a price to a different currency
    • โž• Add Price.toString(unit) method to support formatting in a specific unit
    • โž• Add Money.toString overload to support formatting in a different currency
    • ๐Ÿ”จ Refactor Currencies to be objects rather than vals (no change in usage)
    • โž• Add Currency./ method for creating exchange rates
    • โž• Add MoneyNumeric
    • โž• Add Comparisons for cross-currency Money values (==#, !=#, <#, <=#, >#, >=#)
    Other General Improvements
    • โž• Add Quantity.toString overload that supports standard number formatting (ie, "%3.2f")
    • โž• Add โ‰ˆ as another approx operator
    • โž• Add SquantifiedBigDecimal, remove SquantifiedNumeric
    • Factor out common data and behavior to new QuantityCompanion trait - implemented for all data types except Money which currently requires special handling
    • ๐Ÿ‘€ Implement String => Quantity parsing conversions returning Try[Quantity] for all existing types (see Migration Notes below)
    • โž• Additional Units:
      • ElectricCharge: MilliampereHours, MilliampereSeconds
    • โž• Add unapply to UnitOfMeasure trait and deprecate existing extractors in its favor
    • โœ… Json Serialization - experimental, test code only
    • โœ… Generic Quantity Value - experimental, test code only
    • โž• Add support for Scala cross-version builds (2.10 and 2.11) with 2.11.1 as the default
    ๐Ÿ› Bug fixes
    • ๐Ÿ›  Fixed SquareInches.symbol

    Migration Note

    ๐Ÿ“œ Quantity String Parsing

    ๐Ÿ“œ String parsers no longer return Either[String, Q] but will return a Try[Q] instead (where Q is the specific quantity type). For example, Mass("10 kg") will return a Try[Mass].

    ๐Ÿ‘€ On failure the Try.failed will contain a QuantityStringParseException which includes the original string to be parsed. This could be used to recover using an alternative parser.

    Quantity Value Model Unification

    ๐Ÿ”จ Quantity types implemented as case classes which stored the ratio components of their value (i.e. Velocity(length, time)) have been refactored to have a single underlying value.

    โœ… This reduction of all types to a single underlying value has resulted in some loss of precision - reflected in the use of more "approximately equal to" tests. However, this change is a precursor to future work that will support far better precision.

    Temperature and Money remain as exceptions to the prevailing model.