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:
- Numeric type for value representation: Keep
double? Switch to decimal? Offer both? Separate nugets? What about float?
- Base types: To make it easier working with quantities generically, accessing value and unit, get units and their abbreviations, parsing and ToString() without know the quantity type in advance.
struct vs class: Weigh all the pros and cons, performance (stack vs heap), inheritance vs interface
class: 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 type
List of breaking changes to make
Removing things
Changing behavior
Renaming
Fixing
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?structvsclass: 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
Temperaturearithmetic, it is not correct (made this breaking change already, due to existing behavior not being correct).UnitClasstype, replaced byQuantityTypeFromfactory 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.Teaspoonunit that was too ambiguousUnitSystem, should useUnitSystem.DefaultinsteadChanging behavior
Renaming
Accelerationunits missing pluralsinMeters(fixed in Plural fix for accelerations #434)Fixing