-
Notifications
You must be signed in to change notification settings - Fork 122
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
DefaultFormatter is removed, no replacement? #491
Comments
I found that this PR just dropped the entirety of |
I dropped the |
Sorry but how did you figure this out? Experimental API was explicitly documented on the primary documentation page and readme, and it did provide very useful features. Right now, missing functionality of Again, since this API is experimental, it is all right to drop it for whatever reason, burden of maintenance included, but it is quite jarring that it was done without any explanations or notes, and documentation is misleading now :( |
You can see how the decision was reached in the PR In that PR support for scala 3 was added and some sacrifices were made (also no scala-native) or most likely there wouldn't be scala 3 support at all. As for documentation, I don't have access to the orginal website nor rights to update it. We may want to update the README to be in sync with the current code. PRs are certainly welcome in documentation and/or to restore the removed functionality |
NOTE - the website at squants.com is a GitHub page that displays the current README. |
The current README still discusses the non-existent Can you please at least update the README and spare other people the trouble and headscratching I just went through? |
For what it's worth, if you're using scala 3 you can more or less copy-paste the val powerFormatter = new DefaultFormatter(PowerUnitGroup)
extension(power: Power) def inBestUnit = powerFormatter.inBestUnit(power) where object PowerUnitGroup extends UnitGroup[Power]:
val units: Set[UnitOfMeasure[Power]] = Set(Watts, Kilowatts, Megawatts, Gigawatts) (for instance). With the above in place you can do stuff like scala> Kilowatts(1000).inBestUnit
val res2: squants.energy.Power = 1.0 MW
scala> Kilowatts(1000000).inBestUnit
val res3: squants.energy.Power = 1.0 GW |
Huh?! |
Documentation still says that there is an API for formatting in the best unit, via
DefaultFormater
. Yet, it appears that it was removed in the latest version. I couldn't find any public discussions or tickets about it and reasoning for its removal, and there is no indication that there is a replacement. Does this mean that I cannot upgrade to the latest version if I want this functionality?The text was updated successfully, but these errors were encountered: