JuliaIO / JLD2.jl

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

Saving tuple-like types of unknown size #402

Closed Cornelius-G closed 8 months ago

Cornelius-G commented 2 years ago

Hi,

should it be possible to save tuple-like types of unknown size?

Currently, this is not working:

using JLD2

T = NTuple{N, Int} where N
jldsave("test.jld2", myT = T)

but giving the following stacktrace.txt

Interestingly, this way it works:

struct test_workaround
    a::(NTuple{N,Int} where N)
end

jldsave("test.jld2", a=test_workaround)

while this is again giving the same error:

struct test{X<:(NTuple{N,Int} where N)}
    a::X
end
jldsave("test.jld2", a=test)

(This issue is closely related to https://github.com/oschulz/ValueShapes.jl/issues/62)

JonasIsensee commented 2 years ago

You are right, that should probably be possible.

JonasIsensee commented 8 months ago

fixed by #519