Skip to content

💥Remove decimal support - #1359

Merged
angularsen merged 11 commits into
angularsen:release/v6from
Muximize:remove-decimal-support
Feb 23, 2024
Merged

💥Remove decimal support#1359
angularsen merged 11 commits into
angularsen:release/v6from
Muximize:remove-decimal-support

Conversation

@Muximize

@MuximizeMuximize commented Jan 27, 2024

Copy link
Copy Markdown
Contributor

Changes

  • Remove QuantityValue, replaced with double
  • Remove TValueType from interfaces
    • Remove IQuantity<TUnitType, out TValueType>
    • Remove IValueQuantity<out TValueType>
    • Change IQuantity<TSelf, TUnitType, out TValueType> to IQuantity<TSelf, TUnitType>
    • Change IArithmeticQuantity<TSelf, TUnitType, TValueType> to IArithmeticQuantity<TSelf, TUnitType>

Changes to UnitsNet.Serialiation.JsonNet

  • Deserializing previously serialized JSON for decimal quantities Information, BitRate and Power still work, but it now reads just double Value property and ignores string ValueString and string ValueType properties. This may lose precision compared to preserving the full decimal value, but decimal is no longer supported in v6.

Background

In #1195@angularsen says:

If we change all 3 quantities to double, we have the potential to clean up a LOT of QuantityValue complexity.

This made me wonder how deep that complexity goes so I decided to experiment, and this is the result.

I must say some of these changes make me a bit sad. A lot of work and some very clever thinking went into supporting multiple numerical types, and I want to acknowledge that. 🙇

Also, I took it as far as possible but that might not be the best outcome, for example we might want to keep deserialization support. This just demonstrates a possible direction we could go in.

@angularsen
angularsen marked this pull request as ready for review February 18, 2024 19:54
@angularsen

Copy link
Copy Markdown
Owner

I synced this with release/v6 branch after merging #1195#1353

Will do a review of this next.

@angularsenangularsen self-assigned this Feb 18, 2024
@Muximize
Muximizeforce-pushed the remove-decimal-support branch from ea94306 to 8f655e4CompareFebruary 19, 2024 16:47
@Muximize

Copy link
Copy Markdown
ContributorAuthor

I rebased this to clean up the commit history, which should aid in reviewing.

@angularsenangularsen left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

As you said, it's a bit sad to see a lot of thought and work being thrown out, but I still do think reducing this complexity is worth it until we find a better way to support multiple numeric types in a more holistic way.

I made a few minor improvements and pushed it.

Comment threadUnitsNet.Serialization.JsonNet/UnitsNetBaseJsonConverter.cs
@angularsenangularsen added this to the vNext milestone Feb 23, 2024
@angularsenangularsen changed the title Remove decimal support💥`Remove decimal supportFeb 23, 2024
@angularsenangularsen changed the title 💥`Remove decimal support💥Remove decimal supportFeb 23, 2024
@angularsen
angularsen merged commit 1d644f8 into angularsen:release/v6Feb 23, 2024
@angularsenangularsen mentioned this pull request Feb 23, 2024
28 tasks
@Muximize
Muximize deleted the remove-decimal-support branch February 24, 2024 16:15
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@Muximize@angularsen