Skip to content

Problems with 'loading' types in modules #134

@wg030

Description

@wg030

Hi!
I have some problems with loading saved Interpolants again. My original problem (see #99) dissapeared with a update a few days later.
However right now I am trying to organize my code in modules. My new code as a minimal working example looks as follows.

runfirst.jl:

using JLD2, FileIO
using Interpolations

x = [-1, 0, 1, 2]
y = x.^2
intp = interpolate( (x,), y, Gridded( Linear()))
@save "f.jld2" intp

tmp.jl:

push!( LOAD_PATH, pwd())

using JLD2, FileIO
using Interpolations
using TMPModule

println( "Test: $(intp(1.5))")

TMPModule.jl:

module TMPModule

using JLD2, FileIO
using Interpolations

export intp

#=
# this works as expected!
x = [-1, 0, 1, 2]
y = x.^2
intp = interpolate( (x,), y, Gridded( Linear()))
# =#

# this does not work
@load "f.jld2" intp

end

The @load command in TMPModule causes the following error, whereas if I generated the variable intp as demonstraded in the code that is commented out everything would work as I would love it to.

┌ Warning: type Interpolations.Interpolations.GriddedInterpolation{Float64,1,Int64,Interpolations.Interpolations.Gridded{Interpolations.Interpolations.Linear},Tuple{Array{Int64,1}}} does not exist in workspace; reconstructing
└ @ JLD2 C:\Users\homer.julia\packages\JLD2\KjBIK\src\data.jl:1154

WARNING: eval into closed module ReconstructedTypes:
Expr(:struct_type, Symbol("##Interpolations.Interpolations.GriddedInterpolation{Float64,1,Int64,Interpolations.Interpolations.Gridded{Interpolations.Interpolations.Linear},Tuple{Array{Int64,1}}}#363"), svec(), svec(:knots, :coefs), Any, svec(Tuple{Array{Int64, 1}}, Any), false, 0)
** incremental compilation may be broken for this module **

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions