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

Covers some angular use-cases by providing a 'AngularTest' class. #258

Merged
merged 1 commit into from
Sep 26, 2019
Merged

Conversation

andi-huber
Copy link
Member

@andi-huber andi-huber commented Sep 16, 2019

Addressing the discussion in #257, I've added 3 test-cases, where the last one includes a vague proposal for an API extension.


This change is Reviewable

@keilw
Copy link
Member

keilw commented Sep 17, 2019

API extension? I'm not sure, if that's required, but refining some implementation details, that is likely and possible.

There should be no real major API changes before another JSR some day in the future, only bug fixes via a MR. Improvements of Indriya that is another story, MixedRadix/CompoundQuantity are good examples, also the DimensionalModel was never part of the API. And I cannot say, if they ever do. Some maybe, take Prefix, others probably stay comfortably here.

@wnreynoldsWork
Copy link

Hmm... pretty slick. Adds a category to a unit, and if units have same dimension but different categories, then isCompatible() returns false. The dimensionless unit still obeys principle of least surprise in that mySteradian.multiply(meters.pow(2)).getDimension() = "Area'.

Only challenge is it doesn't solve the problem of people using degrees for radians by accident and blowing up the rocket, but it certainly solves the dimensional analysis problem.

@andi-huber
Copy link
Member Author

andi-huber commented Sep 17, 2019

Thoughts on this idea of 'categories' for units:

  1. Indriya (RI) provides all predefined Units without associating any categories to these. (STERADIAN could be the exception.)
  2. Declaring Units with associated categories is up to the RI user and allows for context specific refinement of the implemented 'dimensional analysis'.
  3. Associating categories with Units creates new instances of Units.
  4. Do Units with associated categories need a new (textual output) format?
  5. Quantity addition/subtraction must throw if the operands' Units are not compatible.
  6. Quantity multiplication is allowed for operands of incompatible units. There seems to be evidence [1], that multiplication/division of Units of different categories does work consistently, if we treat categories like (pseudo-) dimensions.
  7. We could probably provide this new functionality for RI without having to touch the API.

[1] https://en.wikipedia.org/wiki/Dimensional_analysis#Extensions

@keilw keilw merged commit 86985e6 into unitsofmeasurement:master Sep 26, 2019
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.

None yet

3 participants