You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the registered units, are linked to the module instead of the identifier. For this reason, the @u_str macro does not work when the module is imported with as.
MWE
With the module
module MM
using Unitful
function__init__()
Unitful.register(@__MODULE__)
end@unit px "px" Pixel 36u"nm"falseend
and in the REPL
In [1]:using MM: MM as M
In [2]:using Unitful
In [3]:u"px"
ERROR: LoadError: ArgumentError: Symbol `px` was found in the globally registered unit module MM
but was not in the provided list of unit modules Unitful.
(Consider `using MM`in your moduleif you are using`@u_str`?)
Stacktrace:
[1] lookup_units(unitmods::Vector{Module}, sym::Symbol)
@ Unitful ~/.julia/packages/Unitful/orvol/src/user.jl:701
[2] var"@u_str"(__source__::LineNumberNode, __module__::Module, unit::Any)
@ Unitful ~/.julia/packages/Unitful/orvol/src/user.jl:639
in expression starting at REPL[3]:1
but when you import it using the name where it is registered, it works as normal
In [4]:using MM
In [5]:u"px"> px
The text was updated successfully, but these errors were encountered:
When using
the registered units, are linked to the module instead of the identifier. For this reason, the
@u_str
macro does not work when the module is imported withas
.MWE
With the module
and in the REPL
but when you import it using the name where it is registered, it works as normal
The text was updated successfully, but these errors were encountered: