Hi,
I came across the following issue. If I instantiate a Nullable{T} where T
is an abstract type, and then try call deepcopy on it, I get UndefRefError.
For example,
julia> a = Nullable{Real}()
Nullable{Real}()
julia> b = deepcopy(a)
ERROR: UndefRefError: access to undefined reference
in _deepcopy_t at deepcopy.jl:43
in deepcopy_internal at deepcopy.jl:28
in deepcopy at deepcopy.jl:8
This doesn't happen when T isn't abstract, e.g.,
julia> a = Nullable{Float64}()
Nullable{Float64}()
julia> b = deepcopy(a)
Nullable{Float64}()
works just fine. This can be remedied by overloading deepcopy for Nullable
types,
Base.deepcopy{T}(x::Nullable{T}) = isnull(x) ? Nullable{T}() : deepcopy(x)
but was wondering if I'm missing something or maybe this is bug and the the
former function should be added to Base.
I'm working on version 0.4.0.
Uri