Skip to content
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

Simplify the CurrencyValue protocol #46

Merged
merged 3 commits into from
Jan 7, 2025
Merged

Simplify the CurrencyValue protocol #46

merged 3 commits into from
Jan 7, 2025

Conversation

Mordil
Copy link
Collaborator

@Mordil Mordil commented Jan 7, 2025

Motivations:

The current CurrencyValue protocol has a few requirements with default implementations that are not meant to be extension points on the protocol.

In addition, a few aspects of how the protocol can be used are a bit rough in either performance or generic ergonomics.

Modifications:

  • Add: AdditiveArithmetic conformance for free
  • Add: @inlinable annotations to remaining mutating and localization methods
  • Change: minorUnits and roundedAmount properties / initializers to be pure extensions

Result:

Developers are able to use CurrencyValue in greater generic contexts with slightly better performance capabilities, while also having more protection from incorrectly override expected behavior.

@Mordil Mordil added enhancement New feature or request semver-major Require SemVer Major bump labels Jan 7, 2025
@Mordil Mordil merged commit 42e8c8a into 0.7.0 Jan 7, 2025
29 checks passed
@Mordil Mordil deleted the simplification branch January 7, 2025 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request semver-major Require SemVer Major bump
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants