For me there is no segfault, and indeed there's a friendly error message. Not 
sure who wrote it, but maybe it was me :-).

julia> type MyType
          a::Int
       end

julia> m = MyType(7)
MyType(7)

julia> using HDF5, JLD

julia> @save "/tmp/test.jld" m

julia> 
tim@diva:~$ julia
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" to list help topics
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.3.0-prerelease+1981 (2014-03-12 06:36 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit 7e94cfb* (1 day old master)
|__/                   |  x86_64-linux-gnu

julia> using HDF5, JLD

julia> @load "/tmp/test.jld" m
ERROR: Type MyType is not recognized. As a fallback, you can load /m with 
readsafely().
 in read at /home/tim/.julia/v0.3/HDF5/src/jld.jl:247
 in read at /home/tim/.julia/v0.3/HDF5/src/jld.jl:209
 in anonymous at no file



On Thursday, March 13, 2014 06:54:30 AM Patrick O'Leary wrote:
> On Thursday, March 13, 2014 8:48:30 AM UTC-5, Tim Holy wrote:
> > IIRC it does actually store the definition of types in a "hidden" group
> > inside
> > the file. But in general it's hard to make use of: what if the type is
> > defined
> > inside a module that hasn't been loaded? So yes, HDF5/JLD are a little bit
> > fragile when it comes to types; unfortunately, I don't think there is a
> > good
> > solution---it's basically a consequence of having modules (which are a
> > good
> > thing!).
> 
> The segfault is suboptimal though. Since you store the structure of the
> source type on serialization, can we check for the existence of an
> equivalently-defined type before deserializing? Though the fact that Ben
> said he changed the *abstract* supertype is confusing; why would that
> matter? Or do I misunderstand him?

Reply via email to