You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.
The Price class inherits add(), subtract() and divide() from the Fraction class, as well as comparison functions (LT, GT,...).
All of these functions therefore take Fraction as the second argument.
Only the multiply function is overwritten and accepts Price<TQuote, TOtherQuote> as a second argument.
This is nearly the exact opposite behaviour of what I would intuitively expect. It makes sense to multiply or divide a Price with a Fraction, BigIntish or even Percent, but it makes no sense to add, divide or compare two totally different Price Objects and get a Fraction object in return.
What is the reason for this design decision?
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The Price class inherits
add()
,subtract()
anddivide()
from the Fraction class, as well as comparison functions (LT, GT,...).All of these functions therefore take
Fraction
as the second argument.Only the multiply function is overwritten and accepts
Price<TQuote, TOtherQuote>
as a second argument.This is nearly the exact opposite behaviour of what I would intuitively expect. It makes sense to multiply or divide a Price with a Fraction, BigIntish or even Percent, but it makes no sense to add, divide or compare two totally different Price Objects and get a Fraction object in return.
What is the reason for this design decision?
The text was updated successfully, but these errors were encountered: