BSON.jl
BSON.jl copied to clipboard
BSON.@save has side effects
Hi,
I just encountered following side effect (in a more complex scenario, boiled down to the minimum):
using BSON
a = Dict{Symbol, Any}(:a => Float32.([1]))
BSON.@save "/tmp/deleteme.bson" a
After that a is changed to contain all the type information that is probably generated to write the output.
Dict{Symbol,Any} with 1 entry:
:t => Dict{Symbol,Any}(:tag=>"array",:type=>Dict{Symbol,Any}(:tag=>"datatype",:params=>Any[],:name=>Any["Core", "Float32"]),:size=>Any[3],:data=>UInt8[0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x40, 0x00, 0…
After loading the dict again:
BSON.@load "/tmp/deleteme.bson" a
A is restored in its original form. To me this was unexpected behaviour and I did not find any documentation that there may be side effects when using @save.
System:
Julia Version 1.5.2
Commit 539f3ce943 (2020-09-23 23:17 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: AMD Ryzen 7 4800H with Radeon Graphics
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-9.0.1 (ORCJIT, znver2)
BSON:
[fbb218c0] BSON v0.2.6
Apart from that minor issue, thanks for this fabulous library!
This probably boils down to #26 , right?