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
As I mentioned in #2131, one thing that I would like to see is moving to a composition architecture. We already did this with delegates. We can do it now with conversions.
The idea is to have a delegate to handle conversion between multiplicative units, non multiplicative units, and so on.
In addition, I would like to see if possible to add a flag to Unit that quickly dispatch. This has several benefits
clean code
caching
simplify tesing some other architectures
This would allow us also to raise an exception when an illegal operation. For example (I am eliding the magnitude of the unit for convenience)
u1 = meter (flagged as multiplicative)
u2 = second (flagged as multiplicative)
u3 = u1/u2 (flagged as multiplicative)
u4 = degC (flagged as offset unit)
u5 = degC / u2 (error)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
As I mentioned in #2131, one thing that I would like to see is moving to a composition architecture. We already did this with delegates. We can do it now with conversions.
The idea is to have a delegate to handle conversion between multiplicative units, non multiplicative units, and so on.
In addition, I would like to see if possible to add a flag to Unit that quickly dispatch. This has several benefits
This would allow us also to raise an exception when an illegal operation. For example (I am eliding the magnitude of the unit for convenience)
u1 = meter (flagged as multiplicative)
u2 = second (flagged as multiplicative)
u3 = u1/u2 (flagged as multiplicative)
u4 = degC (flagged as offset unit)
u5 = degC / u2 (error)
Does this make sense to you?
ping #2108
Beta Was this translation helpful? Give feedback.
All reactions