JuliaPhysics / JuliaPhysics/Unitful.jl

Better mechanism for defining units in precompiled packages

Open
#613 0 comments 0 reactions 0 assignees View on GitHub
v2.0
Dominant language
Julia
Stars
675
Forks
124
Avg merge
3h 38m
Merged PRs (30d)
1

Description

The problem with the current approach became apparent in https://github.com/JuliaLang/julia/issues/48078. The documentation was changed in #600 to work around the issue. Also related: #545, #601.

In earlier Unitful versions (before v0.17), `Unitful.basefactors` required the same treatment as `Unitful.promotion`. This was changed in #251, extending `Unitful.basefactors` is now done in `Unitful.register`. [^1] One option would be to do the same thing for `Unitful.promotion`. However, this means that users *must* call `Unitful.register`, even if they don’t want to make their units available in the `@u_str` macro, so we should add an option to not add the module to `Unitful.unitmodules`.

Another suggestion from https://github.com/PainterQubits/Unitful.jl/pull/600#discussion_r1062611033 that I haven’t looked into:

> Even better might be for `Unitful` to be aware of how to look inside the `localpromotion` of the individual packages, and remove this burden from users entirely. See how `Docs.meta(Main)` is implemented for example.

[^1]: Before v0.17, `Unitful.register(module)` only added `module` to the list of modules for looking up symbols in the `@u_str` macro.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.