-
Notifications
You must be signed in to change notification settings - Fork 385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v5: Wishlist for breaking changes #180
Comments
Ping @JKSnd @eriove @ferittuncer to subscribe to updates to this thread. Question: Should we change this
to this
Delta is already covered by the quantity, so it feels redundant. Just noticed this when reviewing https://github.com/angularsen/UnitsNet/pull/324/files#diff-1067499ac8bb37a45676058d184d0547R55 |
Yes, that sounds like a good change. We could add the new function and mark the old one as obsolete immediately. That would make the migration easier |
Please add this to wishlist: Correct SingularName for some Flow unit definitions. see #360 |
I propose making parsing stricter:
This would be more in consistent with framework parsing methods (like See #343 for additional context. |
@bplubell How about we actually have a separate parsing method for the feet-inch special case? Something like |
Remove inconsistent abbreviation for cubic feet |
@angularsen Re: Public bool TryParse(string value, out Length length)
{
if (!QuantityParser.TryParseExact(value, out length))
{
if (!Length.TryParseFeetInches(value, out length))
{
return false;
}
// else if over additional special cases if necessary
}
return true;
} |
@bplubell Good example. I favor keeping it simple from the user's stand point, so that |
I have created a new branch It will be a fairly big undertaking to complete all this, but I propose we start on this before the list grows unmanageable and the jump from 3.x to 4.x becomes too great from the consuming side. |
Acceleration units missing plural s in Meters is fixed in #434 |
Updated the checklist |
I guess we should have bumped the major number for that eh :) |
Right, my bad, I thought we obsoleted the old units. We should probably add the old ones back and mark them obsolete. |
vNext is long overdue now, I muted thousands of build warnings about obsolete code earlier because they just spammed the build log and we don't take any dependencies I expect to be obsoleted anytime soon. |
Added to list:
And organized list into category of changes. |
Closing this since most of the discussions above are covered in v4 #487. |
# 4.0.0 Release This PR will serve as the list of items to complete and it will be updated to show the progress before finally merged into `master` when completed. We all have busy schedules, so **if you want to help move this work forward then that is much appreciated!** ## The main theme is to reduce binary size In two years it has grown from 280 kB to 1.4 MB and a lot of it is due to unnecessary syntactic sugar with many method overloads for various number types and nullable types - for every of our 800+ units! It simply adds up to a big total. These items are chosen from #180, trying to include as many of the low hanging fruits as possible, while still keeping the list short and realistic to complete in a reasonably short time - we are all busy in our daily lives. We can always have more major version bumps later than trying to perfect it all now. ## Feature complete before November, merged before mid-December I would like to aim for a "beta" pre-release nuget sometime in October with all the items completed, so we can have some time to test it before releasing the final, stable 4.0.0 version before Christmas holidays. We should have the work items list more or less final before Monday, October 8th. ## Changes #### Added - [x] UnitSystem with a different meaning, now defines the base units for a unit system (#524) #### Removed - [x] Replace netstandard1.0 target with netstandard2.0, to avoid the extra dependencies (#477) - [x] Remove code marked as `[Obsolete]`, such as `VolumeUnit.Teaspoon` (#490) - [x] Remove nullable `From` factory methods (#483) - [x] Remove extension methods on _nullable_ number types (#483) - [x] Remove all number extension methods (#497) - [x] Remove `Length2d`, replaced by `Area` (#501) - [x] Remove static methods on `UnitSystem`, should use `UnitSystem.Default` instead (#496) - [x] Remove unit parameter from `ToString()` methods (#546) #### Changed - [x] Throw exception on NaN values in static constructor methods, like `FromMeters()` (#502, see #176 (comment)) - [x] Throw if unit was not specified when constructing quantities, (#499 - #389 (comment)) - [x] Stricter parsing (#343 and #180 (comment)) - [x] Remove unit parameter from `ToString()` methods (#546) - [x] Change Temperature arithmetic back to use base unit Kelvin (#550, see #518) #### Renamed - [x] Correct SingularName for some Flow unit definitions (#494, see #360) - [x] Split/rename UnitSystem into UnitParser, GlobalConfiguration, UnitAbbreviationsCache (#511) #### Fixed - [x] Search for any TODO comments in the code to address, remove comment and either fix or create issue (5d24432) - [x] Update README with v4 changes #498 - [x] Do not try/catch in UnitConverter.Try-methods (#506) - [x] Do not try/catch in `Length.TryParse()` and for other quantities (#507) - [x] Add/update changelog in wiki for v4 with some summary copied from this issue, some v3 to v4 migration instructions and briefly explain why some stuff were removed ## Milestones - [x] Finalize work items list (Monday, October 8) - [x] Release 4.0.0-beta1, feature complete (Wednesday, October 31) - [ ] ~Show release notes and upgrade guide when upgrading to 4.x nuget, if possible~ - [x] Release 4.0.0 (Monday, December 17)
Fixes #180 Merging the v5 release branch. It is still in alpha, but it is functional, nugets are published and there are not many planned breaking changes left. By merging, all efforts moving forward are targeting v5 and this reduces friction: - No more merge conflicts trying to forward port all changes to v5, instead cherry pick new units and fixes to v4 until v5 is fully stable. - Contributors are having trouble building v4 locally due to `net40`, `net47` and Windows Runtime Component targets. ## 💥 Breaking changes Default number format should be CultureInfo.CurrentCulture, not CurrentUICulture (#795) Use CurrentCulture rather than CurrentUICulture (#986) Return `QuantityValue` in `IQuantity` properties instead of `double` (#1074) Return `decimal` in properties of `Power`, `BitRate` and `Information` quantities (#1074) Fix singular name VolumeFlow.MillionUsGallonsPerDay ## 🔥 Removed Remove targets: net40, net47, Windows Runtime Component. Remove `Undefined` enum value for all unit enum types Remove QuantityType enum Remove IQuantity.Units and .UnitNames Remove IQuantity.ToString() overloads Remove IEquatable<T> and equality operators/methods Remove GlobalConfiguration Remove obsolete and deprecated code. Remove Molarity ctor and operator overloads Remove MinValue, MaxValue per quantity due to ambiguity Remove string format specifiers: "v", "s" json: Remove UnitsNetJsonConverter ## ✨ New QuantityValue: Implement IEquality, IComparable, IFormattable QuantityValue: 16 bytes instead of 40 bytes (#1084) Add `[DataContract]` annotations (#972) ## ♻️ Improvements Upgrade CodeGen, tests and sample apps to net6.0. ## 📝 JSON unit definition schema changes Rename `BaseType` to `ValueType`, for values "double" and "decimal". Rename `XmlDoc` to `XmlDocSummary`. ## TODO Add back `IEquatable<T>`, but implement as strict equality with tuple of quantity name + unit + value. #1017 (comment) ## Postponed for later #1067
Although there are no immediate plans to do a vNext, this issue serves as a wishlist/reminder of what to consider changing in case we need to bump the major version in the future.
To clarify
These are some things we should figure out before finalizing version 4.
A common denominator for design choices is binary size.
The library was nearing the 1MB mark and the majority of that is the large number of methods and properties for all our 700+ units. In particular number extension methods add 8 methods per unit (!). With some clever hacks we brought this back to 600kB without any breaking changes, but we want to keep binary size in mind for any new changes we introduce.
TODO Clean up and organize this brain dump:
double
? Switch todecimal
? Offer both? Separate nugets? What aboutfloat
?struct
vsclass
: Weigh all the pros and cons, performance (stack vs heap), inheritance vs interfaceclass
: Can support all number types (float, double, decimal) without increasing binary size N times (discussion)struct
: More suitable for performance and memory constrained applications (what is the impact in practice?), avoids pressure on garbage collector, quantities match the semantics of being a value typeList of breaking changes to make
Removing things
Temperature
arithmetic, it is not correct (made this breaking change already, due to existing behavior not being correct).UnitClass
type, replaced byQuantityType
From
factory methods causing N additional methods for N units, see comment==
!=
andEquals(object)
andEquals<T>(T)
since they don't take a max error argument and is prone to floating point rounding issues, instead users should useEquals()
methods that take a max error argument[Obsolete]
, such asVolume.Teaspoon
unit that was too ambiguousUnitSystem
, should useUnitSystem.Default
insteadChanging behavior
Renaming
Acceleration
units missing plurals
inMeters
(fixed in Plural fix for accelerations #434)Fixing
The text was updated successfully, but these errors were encountered: