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

Initial implementation #1

Merged
merged 9 commits into from
Jan 13, 2020
Merged

Initial implementation #1

merged 9 commits into from
Jan 13, 2020

Conversation

Mordil
Copy link
Member

@Mordil Mordil commented Jan 10, 2020

No description provided.

Copy link
Member

@thonydam thonydam left a comment

Choose a reason for hiding this comment

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

Looks good to me 👍 !

Have minor comments about naming that you can ignore if you feel strongly about it.

///
/// See `CurrencyMetadata.minorUnits` and `Foundation.Decimal.RoundingMode.bankers`.
/// - Note: This is usually the desired value to work with, as it is as precise as usually needed.
var amount: Decimal { get }
Copy link
Member

Choose a reason for hiding this comment

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

rawAmount is not super meaningful. What we call Amount here is not the actual amount but the rounded value.

To be more explicit, should we have:
rawAmount => amount
amount=> roundedAmount or rounded

Copy link
Member Author

Choose a reason for hiding this comment

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

I actually had that original naming, but towards the end I moved to the current naming - as my concern is many people would use amount when they really want roundedAmount. 99% of the time, people want the every day banker's rounded value.

How do you feel about:
amount => roundedAmount
rawAmount => exactAmount

Copy link
Member

Choose a reason for hiding this comment

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

👍

/// To get around this, the provided `other` amount will be rounded to the same precision as the `minorUnits` of the Money's currency using the "banker" mode.
///
/// See `Money.amount`.
/// - Parameter other: The other amount to "bankers' round, then compare against.
Copy link
Member

Choose a reason for hiding this comment

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

The parameter description kind of implies that we should pass other as the rounded amount. Where we should actually pass the actual amount.

Copy link
Member Author

@Mordil Mordil Jan 12, 2020

Choose a reason for hiding this comment

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

That's a reasonable misunderstanding - I'll clarify this section.

@Mordil Mordil merged commit bfba7b1 into master Jan 13, 2020
@Mordil Mordil deleted the initial-implementation branch January 13, 2020 17:54
Sign up for free to 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