Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type with symbol parameter doesn't save correctly in JLD #211

Closed
GunnarFarneback opened this issue Jan 24, 2015 · 2 comments
Closed

Type with symbol parameter doesn't save correctly in JLD #211

GunnarFarneback opened this issue Jan 24, 2015 · 2 comments

Comments

@GunnarFarneback
Copy link

This fails:

julia> using HDF5, JLD

julia> type Foo{T} end

julia> a = Foo{:a}()
Foo{:a}()

julia> save("test.jld", "a", a)

julia> b = load("test.jld", "a")
WARNING: type Foo{a} not present in workspace; reconstructing
##Foo{a}#7932()

julia> @assert typeof(a) == typeof(b)
ERROR: assertion failed: typeof(a) == typeof(b)
 in error at ./error.jl:21

The core problem seems to be that symbols print without any indication of being symbols.

julia> print(:a)
a

One possible solution is to add a method

full_typename(io::IO, ::JldFile, x::Symbol) = print(io, ":", x)

in JLD.jl but I don't know whether that's the right way to go.

@mbauman
Copy link
Member

mbauman commented Jan 27, 2015

Sorry I didn't notice this sooner - This was fixed in #203 (with exactly your solution), but a new release of HDF5 hasn't been tagged yet.

@mbauman mbauman closed this as completed Jan 27, 2015
@mbauman
Copy link
Member

mbauman commented Jan 27, 2015

It may not end up being the final solution here, however. See #204.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants