Unitful.jl
Unitful.jl copied to clipboard
uconvert documentation update
Under quickstart in the documentation the uconvert function as written does not work. The documentation should be updated. The first line is a direct copy from the documentation and the second line is what works.
julia> uconvert(°C, 212°F)
ERROR: UndefVarError: °F not defined
Stacktrace:
[1] top-level scope
@ REPL[24]:1
julia> uconvert(u"°C", 212u"°F")
100//1 °C
In the next examples we assume we have brought some units into our namespace, e.g.
const m = u"m"
, etc.
?
I did read it, but did not comprehend it so ignored it, hoping the examples would explain completely how to use uconvert.
For me it would have been helpful to have one example that showed how to do this. Some guidance on when this should be done would also help me.
Jake
From: Mosè Giordano @.> Sent: November 9, 2022 4:25 PM To: PainterQubits/Unitful.jl @.> Cc: JakeZw @.>; Author @.> Subject: Re: [PainterQubits/Unitful.jl] uconvert documentation update (Issue #581)
Did you miss https://painterqubits.github.io/Unitful.jl/stable/#Usage-examples
In the next examples we assume we have brought some units into our namespace, e.g. const m = u"m", etc.
?
— Reply to this email directly, view it on GitHub https://github.com/PainterQubits/Unitful.jl/issues/581#issuecomment-1309392752 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ADF3P7FDBGV5C2GLD6ZUFYTWHQJELANCNFSM6AAAAAAR33ZXGU . You are receiving this because you authored the thread. https://github.com/notifications/beacon/ADF3P7BH3YWQFVS43NFCMKDWHQJELA5CNFSM6AAAAAAR33ZXGWWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTSOBO7XA.gif Message ID: @.*** @.***> >
We could certainly include the importing in the code examples, I agree that they can easily be overlooked.
I also think the docs should mention that you can do using Unitful: m
instead of const m = u"m"
. I think the former shows more clearly what’s happening. However, const m = u"m"
has the advantage that you don’t need to know which module contains m
(in the case where you are using several packages that define units).