Replies: 1 comment 1 reply
-
@camille-bouvy-frequenz @thomas-nicolai-frequenz FYI. Do you have any preferences opinions about where this |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In frequenz-floss/frequenz-api-electricity-trading#17 we detected the need for a
Quantity
-like class that is backed by aDecimal
.Since we still don't know how common this would be, the easiest approach would be to just add a new
DecimalEnergy
class that has the same interface asQuantity
but uses aDecimal
as the underlying value, just for this use case, which seems to be pretty unique. In the future we'll re-asses if we need to merge it with Quantity or we need some other solution.Since this is only used by the electricity trading API so far, this
DecimalEnergy
might just only be included in the electricity trading client instead of the SDK.If possible, this new class could inherit from
Quantity
too.Alternative solutions are:
Decimal
as a backing type for allQuantity
s (too big of a change, too disruptive, we would need to asses what would be the impact in performance and other aspects for other parts of the system).Quantity
to have different backing types for values, so we could haveEnergy[float]
andEnergy[Decimal]
. This feels like it will be a lot of problem and pollute 99% of the code that needs to use float for very little gain.Beta Was this translation helpful? Give feedback.
All reactions