Following this reasoning, shouldn’t we also have zerounit
for consistency? zero
can be defined as the additive identity.
I find it very strange that we need to write code with a mix of oneunit
and zero
instead of oneunit
and zerounit
.
Following this reasoning, shouldn’t we also have zerounit
for consistency? zero
can be defined as the additive identity.
I find it very strange that we need to write code with a mix of oneunit
and zero
instead of oneunit
and zerounit
.
zero
is defined as the additive identity in Julia. This is a unitful quantity, hence no need for zerounit
.
Originally, Julia had just one
(multiplicative identity) and zero
(additive identity). But then people started mis-using one
for unitful quantities to get the unit (julia#16116), so we introduced oneunit
to disambiguate. There is no similar need for zerounit
.
See also Revise `zero` and define `zerounit`? · Issue #24853 · JuliaLang/julia · GitHub and Change `one` to `onemult` · Issue #36103 · JuliaLang/julia · GitHub for related naming discussions.
Very interesting discussions. Thanks for the links.