-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
mathsMathematical functionsMathematical functionsmissing dataBase.missing and related functionalityBase.missing and related functionality
Description
zero(Missing) currently fails, as does one(Missing) and oneunit(Missing):
julia> zero(Missing)
ERROR: UndefVarError: T not definedThe error comes from this code in base/missing.jl:
for f in (:(Base.zero), :(Base.one), :(Base.oneunit))
@eval function $(f)(::Type{Union{T, Missing}}) where T
T === Any && throw(MethodError($f, (Any,))) # To prevent StackOverflowError
$f(T)
end
endPerhaps zero(::Missing) and one(::Missing) should be missing, since missing + missing == missing and the same for * and those two methods give you the additive and multiplicative identities.
@ararslan suggests adding @eval $(f)(::Type{Missing}) = missing to the loop.
ararslan, 00vareladavid, ChrisRackauckas, andyferris, JulienKluge and 1 more
Metadata
Metadata
Assignees
Labels
mathsMathematical functionsMathematical functionsmissing dataBase.missing and related functionalityBase.missing and related functionality