UnitsNet icon indicating copy to clipboard operation
UnitsNet copied to clipboard

v6 Release

Open angularsen opened this issue 2 years ago • 35 comments

This issue serves as a place to discuss what to include in this version, since major version bumps allow us to make breaking changes we think are necessary or worth it.

The wishlist keeps track of the items to include, but items may be added or removed at any time.

As changes are completed, they are added to https://github.com/angularsen/UnitsNet/wiki/Upgrading-from-5.x-to-6.x

Changes

  • [x] Remove BtuPerSquareFootDegreeFahrenheit #1372
  • [ ] Fix plural form of Speed.MeterPerMinute
  • [ ] Rename/fix calorie/btu units to specify their definition as International Steam Table (IT) or Thermochemical (th), see https://github.com/angularsen/UnitsNet/pull/1196/files#r1105112205
  • [ ] Consistent imperial/UK/US unit namings https://github.com/angularsen/UnitsNet/issues/1200#issuecomment-1493079083
  • [x] UnitAbbreviationsCache.ctor() should create empty cache, not load default abbreviations https://github.com/angularsen/UnitsNet/pull/1476
  • [x] UnitParser.ctor(UnitAbbreviationsCache) should not fallback to built-in units if given null https://github.com/angularsen/UnitsNet/pull/1477
  • [ ] Rename AbsorbedDoseOfIonizingRadiation to RadiationAbsorbedDose https://github.com/angularsen/UnitsNet/pull/1352#issuecomment-1879666525
  • [ ] Review all [Obsolete] in code and add to this list
    • [ ] Remove obsolete Equals overloads https://github.com/angularsen/UnitsNet/pull/1396#issuecomment-2171563287
    • [ ] ~~Remove static Default getters pointing to UnitsNetSetup.Default~~ https://github.com/angularsen/UnitsNet/pull/1475 reverted by #1480
  • [ ] Fix typo in TonneSquareMilimeter, missing l
  • [x] Fix typo in VolumeConcentration.LitersPerMililiter, missing l https://github.com/angularsen/UnitsNet/pull/1497
  • [x] Remove TorquePerLength: dimensionless, domain specific, conflicts with Force = Torque / Length https://github.com/angularsen/UnitsNet/pull/1458
  • [x] Rename ThermalResistance to ThermalInsulance: enables future conversions between thermal conductivity, resistivity if added https://github.com/angularsen/UnitsNet/pull/1460
  • [ ] Change Angle base unit from Degree to Radian
  • [ ] Fix typo KiloNewton => Kilonewton in SpecificFuelConsumption.json
  • [x] https://github.com/angularsen/UnitsNet/issues/1445
  • [x] #1467
  • [x] #1482
  • [x] #1531
  • [ ] Remove IConvertible from IQuantity #1550
  • [ ] Update wiki regarding IQuantity and sample quantity https://github.com/angularsen/UnitsNet/issues/1519#issuecomment-2698816808
  • [ ] Consolidate UnitsNetSetup.Default.UnitConverter and each quantity's DefaultConversionFunctions, these can become inconsistent when adding custom conversion functions at runtime. Consider making DefaultConversionFunctions internal, not public.
  • [ ] Moved IQuantity methods to extension methods with Untyped suffix, e.g. ToUnit() becomes ToUnitUntyped() to improve intellisense from strongly typed extension methods #1600

Fixed

  • [x] #1465

angularsen avatar Feb 12 '23 11:02 angularsen

Add System.Text.Json support https://github.com/angularsen/UnitsNet/pull/966

maxreb avatar Mar 21 '23 08:03 maxreb

Decide on a naming and abbreviation convention for imperial/UK units and US units; like gallon, ounces, cup etc.

It is a bit of a mess right now: image image

image

LINQPad sample
void ListUnits(string withPartialName)
{
    Quantity.Infos
        .SelectMany(i => i.UnitInfos
            .Where(n => n.Name.Contains(withPartialName))
            .Select(u => new 
            { 
                u.Name, 
                Abbrev = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(u.Value.GetType(), Convert.ToInt32(u.Value)) 
            }))
        .Dump(withPartialName);
}

ListUnits("Uk");
ListUnits("Imperial");
ListUnits("Us");

I personally like "UK", since it is shorter and better matches "US". Wolfram also uses US gallon and UK gallon.

Some conventions for imperial gallons: https://en.wikipedia.org/wiki/Gallon#:~:text=the%20imperial%20gallon%20(imp%20gal,American%20and%20Caribbean%20countries%3B%20and

Today the abbreviation convention is gal (U.S.) and gal (imp.). Depending on landing on UK or imperial naming, we could go with one of these pairs:

  • US gal and UK gal
  • US gal and imp gal
  • gal (US) and gal (UK)

We can support multiple of these plus the old ones, but the primary form should be standardized across the different units.

angularsen avatar Apr 01 '23 19:04 angularsen

Do not throw ArgumentException on NaN, Inf+ or Inf- or give a way to configure the behavior globally.

Context: https://github.com/angularsen/UnitsNet/issues/1268#issuecomment-1630856242

ebfortin avatar Jun 24 '23 16:06 ebfortin

I think UnitsNet should be more extensible. Perhaps there could be a base package, but separate NuGet packages for US measurements, Imperial, UK, etc. Alternatively, customizable abbreviations could be a solution. I would never expect me or my users to see "gal (US)" instead of "gal". This would also help the debate here.

UPDATE:

Custom abbreviations already exist: UnitAbbreviationsCache.Default.MapUnitToDefaultAbbreviation(HowMuchUnit.Some, "sm");

MisinformedDNA avatar Sep 12 '23 14:09 MisinformedDNA

I think UnitsNet should be more extensible.

Conceptually, I agree.

Customizable abbreviations is already supported as you found, and we support custom quantities and units with some limited functionality: https://github.com/angularsen/UnitsNet/wiki/Extending-with-Custom-Units

Splitting up in packages is not so easy though. Things like Torque = Force * Length becomes problematic when types exist in different packages and they can't have circular dependencies. Imperial is even worse, splitting some units of a quantity to different packages. The main problem is static typing, which is also one of the main features of UnitsNet.

One benefit of splitting up in packages is smaller binary size to only bring in what you need. Some prototyping here: #1181

angularsen avatar Sep 16 '23 11:09 angularsen

I was requested to give a list of units with the wrong plural form (see #1330 )

I checked the .json-file with the speed units and only MetersPerMinute has a wrong plural form, all other Speed units seem to have the correct plural form.

Markussp256 avatar Nov 29 '23 20:11 Markussp256

@Markussp256

I was requested to give a list of units with the wrong plural form (see #1330 )

I checked the .json-file with the speed units and only MetersPerMinute has a wrong plural form, all other Speed units seem to have the correct plural form.

Some more fixes were made recently in #1351

angularsen avatar Jan 06 '24 11:01 angularsen