-
Notifications
You must be signed in to change notification settings - Fork 8
Description
(I think filing an issue is the proper/expected way to file comments from an interested member of the community. If this should be moved elsewhere please let me know. I am commenting from the perspective of a maintainer of mathjs, a library that has an integrated system for manipulating unit-measured quantities, as well as an extensive library of units.)
The proposal states
Note:
⚠️ All property/method names up for bikeshedding.unit (String or undefined): The unit of measurement with which number should be understood (with undefined indicating "none supplied")
This does not seem to provide the opportunity for a "scalar" or "unitless" Amount. But if there is some future proposal for arithmetic of units, it will very likely need such Amounts. For example, often quantities in Hz are considered equivalently to be in sec^-1, and so if you multiply such an Amount by say new Amount(5, {unit: 'sec'}) you should get something that is a unitless quantity. But you don't want to just downgrade that result to a Number or Decimal -- for one thing, you would lose the precision information, and for another, it would be helpful to know that an Amount times an Amount is always another Amount. On the other hand, we don't want it to be simply be an amount that indicates it is an Amount "with no unit supplied" -- it is explicitly a purely numeric Amount, with no ambiguity.
Therefore, I would suggest that this proposal would be more "future-proof" if some adjustment along one of the following lines is adopted:
-
If there isn't a known use case for "Amount with unspecified unit", then the semantics of having the
unitproperty undefined could be that this is a pure-numeric Amount. Since I don't understand what one might do with an Amount of "5 somethings," without knowing what that something is, I personally would tend to lean in this direction. -
If there is, then this proposal could anoint the
unitvalue being the empty string as the indicator that this is a purely-numeric Amount. Since I think the likelihood that such Amounts will be needed is high, it seems beneficial to claim that semantic space now, rather than run the chance ofnew Amount(7, {unit: ''})having the potential to come to mean something else through usage or other precedent before a follow-on proposal on unit arithmetic is finalized and adopted.