I've got code with many user defined types. I am aware that you're not
supposed to be able to redefine types and that there is a workaround where
you wrap all your code in a module, but for ease of use I'm trying not to
do that right now. I'm finding that sometimes I can reload my coat without
error, but there is a particular type that can't be redefined. Example:
In file "firm.jl" I have a type
immutable FirmParams
kappa::Float64
alpha::Float64
gamma::Float64
beta::Float64
end
and I can run
julia> include("firm.jl")
without error provided I haven't modified FirmParams. If I change
FirmParams it won't work, but I expected that.
In file "aux.jl" I have some types
abstract AggState
abstract IdioState
immutable AggState1 <: AggState
w::Float64
Y::Float64
end
immutable IdioState1 <: IdioState
D::Float64
end
immutable State{T1<:IdioState, T2<:AggState}
is::T1
as::T2
end
and if I run it, I always get
julia> include("aux.jl")
ERROR: LoadError: invalid redefinition of constant State
in include at ./boot.jl:261
in include_from_node1 at ./loading.jl:304
while loading /home/andrew/Documents/julia/ABK/aux.jl, in expression
starting on line 17
The main difference I can see is that State is a parametric type. Is there
some mechanism in the background that allows you to reload unmodified type
declarations, but doesn't work for parametric types?