JuliaIO / JLD2.jl

HDF5-compatible file format in pure Julia
Other
549 stars 85 forks source link

Supporting Dict{Symbol} #420

Closed jc-castillo closed 1 year ago

jc-castillo commented 1 year ago

When trying to save a Dict{Symbol}, it is automatically converted to a Dict{String} before saving (with a warning). Is there any reason why saving a Dict{Symbol} should not be supported, instead of converting it? This causes problems because if I load the modified Dict I cannot use symbols as the key.

JonasIsensee commented 1 year ago

Hi @jc-castillo,

this has been discussed before in #358 . Symbols are a julia type and JLD2 implements a very general file format that only accepts String identifiers. Therefore, you would need to attach the information that this should be considered a Symbol elsewhere.
You can convert symbols to strings when saving but when loading it is not so obvious, where to get the information.