Skip to content

MetrologyNamespace: must constructors accept strings? #11

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

Open
lucascolley opened this issue Mar 17, 2025 · 2 comments
Open

MetrologyNamespace: must constructors accept strings? #11

lucascolley opened this issue Mar 17, 2025 · 2 comments

Comments

@lucascolley
Copy link
Member

An implementation could avoid accepting strings in constructors by forcing users to choose from an Enum of possible units/dimensions. Would this be reasonable? If so, do we want to avoid forcing strings to be accepted?

@nstarman
Copy link
Contributor

With an Enum how would this work with a composite unit or dimension not in the Enum?

asunit("km/(s Mpc candela)")

@lucascolley
Copy link
Member Author

You could require that composite units are composed via operations on their individually constructed parts?

This does seem like a bit of a reach, and if all current libraries are happy to accept strings then I don't think we need to worry about this. Just wanted to flag it as not absolutely necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants