Open Mo-Gul opened 2 years ago
I'm not sure I like using ℎ
for Planck's constant. I don't know what the reasoning was for including it as a codepoint in Unicode, except maybe to complement ℏ
. Why should it have a dedicated symbol and not other constants such as 𝑒
(U+1D452 MATHEMATICAL ITALIC SMALL E, elementary charge), 𝑐
(U+1D450 MATHEMATICAL ITALIC SMALL C, speed of light in vacuum), 𝐺
(U+1D43A MATHEMATICAL ITALIC CAPITAL G, gravitational constant), etc.?
I can agree to using solving the conflict by assigning h
to the more common hour (although that will make my particular usage of pint-convert
more cumbersome), but if obscure/italic characters are going to be used for some constant, they should be used for all (at the very least ħ
should be changed to ℏ
too).
Since this would be breaking, it is something to consider for Unitful 2.0. That said, I’m not sure it is worth the breaking change and I worry that h
and ℎ
might be too easily confused.
I agree that if we change h
to ℎ
, we should also change ħ
to ℏ
. Changing all physical constants to italics would technically be the correct thing to do, but it makes them harder to type (\itc<tab>
instead of just c
).
There is a plan to normalize ℏ
to ħ
: https://github.com/JuliaLang/julia/issues/48870
If this is implemented, Unitful.ℏ
and Unitful.ħ
would automatically refer to the same object (we could still change the printing from "ħ"
to "ℏ"
).
Edit: ℏ
is normalized to ħ
starting from Julia 1.10.
I suggest to change the default "Symbol" and "Display" from
https://github.com/PainterQubits/Unitful.jl/blob/960e09ef518b0d3ff54747460b9c3872c08df0d7/src/pkgdefaults.jl#L252
to
because this should be the usual/common default. As examples have a look at
Of course then also the Planck constant symbol has to change. Therefore I suggest to change
https://github.com/PainterQubits/Unitful.jl/blob/960e09ef518b0d3ff54747460b9c3872c08df0d7/src/pkgdefaults.jl#L422
to
as it is also proposed in the above documents. The corresponding places are
It should be quite natural in Julia to use
ℎ
, since this is also listed in the Julia Manual. (Search for "planck" there.)In case this should also help to consider this breaking change: The same was done recently in
Pint
(the Python equivalent ofUnitful
) in PR https://github.com/hgrecco/pint/pull/1454. See also the corresponding issue https://github.com/hgrecco/pint/issues/719.