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

Access constant reference #35

Closed
Socob opened this issue Oct 4, 2024 · 3 comments · Fixed by #37
Closed

Access constant reference #35

Socob opened this issue Oct 4, 2024 · 3 comments · Fixed by #37

Comments

@Socob
Copy link
Contributor

Socob commented Oct 4, 2024

As far as I can tell, the “reference” that’s defined for a constant and printed in the show method, e. g.

julia> PhysicalConstants.CODATA2018.G
Newtonian constant of gravitation (G)
Value                         = 6.6743e-11 m^3 kg^-1 s^-2
Standard uncertainty          = 1.5e-15 m^3 kg^-1 s^-2
Relative standard uncertainty = 2.2e-5
Reference                     = CODATA 2018

is not available anywhere and only exists within that show method. It would be nice to have a way to access that separately, e. g. via a newly defined function.

@giordano
Copy link
Member

giordano commented Oct 7, 2024

Agreed, PR for an accessor function welcome! Side note, in hindsight I'm not particularly happy with the design of having singletons for which lots of magic methods are defined (which is totally inspired by Base.@irrational), using proper structures would be cleaner (and also better for time-to-first-print a constant).

@Socob
Copy link
Contributor Author

Socob commented Oct 7, 2024

PR created!

I don’t know if there are any drawbacks associated with having more information stored in a struct itself, but for now I didn’t opt to change the entire structure of the package 😉

@giordano
Copy link
Member

giordano commented Oct 7, 2024

Yeah, no worries, that's a larger undertake

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 a pull request may close this issue.

2 participants