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

add formatter docs; minor adjustments for formatter syntax #244

Merged
merged 2 commits into from
May 24, 2017

Conversation

derekmorr
Copy link
Collaborator

This adds docs for formatters. I made some changes since the last PR to make the syntax more consistent.

I'd appreciate feedback on the docs. It can get complicated with unitgroups, formatters, implicits, etc. I'm not sure I structured it in the best way.

Copy link
Collaborator

@cquiroz cquiroz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. I added a couple of comments

@@ -709,6 +709,123 @@ The `UnitGroup` values provided with Squants are only samples and aren't intende
We encourage users to make their own `UnitGroup` defintitions and submit them as PRs if they're generally
applicable.

## Formatters

Squants provides an experimental API for formatting Quantities in the "best unit." For example,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder a bit about the experimental part. If this is something we may change then the experimental tag fits very well but then perhaps it should be on an experimental package.

Do you foresee possible changes in the near future that could break the API?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure. We've not had any feedback on the API from people who requested it. Once it's released, it's possible we'll want to change it based on feedback.

I'm fine moving unitgroups and formatters into an experimental package.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess either way the API will change but the experimental would at least be an indication.
I don't have a strong opinion either way

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll refactor it into an experimental package and update the README.


Then create the formatter by passing in a unit group:
```tut:book
val astroFormatter = new DefaultFormatter[Length] { val unitGroup = AstronomicalLengthUnitGroup }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this isn't built just as a regular class? new DefaultFormatter[Length](AstronomicalLengthUnitGroup)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably b/c everything else was a trait. I agree the class syntax is better.

@derekmorr
Copy link
Collaborator Author

I pushed up a commit that addresses the latest comments.

@cquiroz
Copy link
Collaborator

cquiroz commented May 24, 2017

that seems good, we can move it to non experimental on the next release

@derekmorr
Copy link
Collaborator Author

Are we ok to merge this then?

@cquiroz
Copy link
Collaborator

cquiroz commented May 24, 2017

I think so

@derekmorr derekmorr merged commit d3e11db into master May 24, 2017
@derekmorr derekmorr deleted the formatter-docs branch June 12, 2017 12:21
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.

2 participants