julia> load("test.bson")
BSON.BSONDict with 1 entry:
:d => BSON.BSONDict(:v=>0)
According to README, i would expect both the inner and outer dictionaries to be of the `Dict` type when loaded.
2. **Lost array type on reload**
```julia
julia> v = [zeros(1) for i in 1:2]
2-element Array{Array{Float64,1},1}:
[0.0]
[0.0]
julia> D = Dict(:d=>v)
Dict{Symbol,Array{Array{Float64,1},1}} with 1 entry:
:d => [[0.0], [0.0]]
julia> save("test_v.bson", D)
julia> load("test_v.bson")
BSON.BSONDict with 1 entry:
:d => Any[[0.0], [0.0]]
Here, I would expect the loaded dictionary to be Dict, not BSONDict and the array elements to be of type Array{Float64,1}, not Any.
I have played with the updated BSON after https://github.com/JuliaIO/BSON.jl/pull/29 and I still seem to get unexpected behavior:
julia> outer_d = Dict(:d=>inner_d) Dict{Symbol,Dict{Symbol,Int64}} with 1 entry: :d => Dict(:v=>0)
julia> save("test.bson", outer_d)
julia> load("test.bson") BSON.BSONDict with 1 entry: :d => BSON.BSONDict(:v=>0)
Here, I would expect the loaded dictionary to be
Dict
, notBSONDict
and the array elements to be of typeArray{Float64,1}
, notAny
.Quickly looking through the issues, such effects of save and load could imo be the cause of some of the reports (https://github.com/JuliaIO/BSON.jl/issues/76, https://github.com/JuliaIO/BSON.jl/issues/75).
I think it would be worthwhile to mention this behaviour in the README to save people headaches with unexpected errors.
PS: I was having similar issues even before the merge of https://github.com/JuliaIO/BSON.jl/pull/29, the change in https://github.com/JuliaIO/BSON.jl/pull/29 at least made these issues much easier to track.