Say I have a type that defines a model. Something like this:
abstract Model
type Results
# Details not shown here
end
type IFP{T <: FloatingPoint} <: Model
# Model parameters
rho::T
beta::T
r::T
R::T
gamma::T
# Grid parameters for a
n_a::Integer
a_max::T
a::Vector{T}
# Parameters for y
n_y::Integer
y::Vector{T}
P::Matrix{T}
Sol::Results
end
I would like to be able to initialize an object of type IFP, work with it
for a while, pass it to a solution routine, and then fill in the Sol field
at a later time.
Is there a way to leave Sol as an uninitialized field and then fill it in
after the solution has been determined (which will be after constructing
the IFP object and playing around with it for a while)? I suppose one way
would be to have the inner constructor directly call the solution routine
to get the Sol object. However, I want to avoid that because I may want to
manipulate IFP between its construction and actually solving the model it
describes.
------------------------------
One more note. In this specific use case Sol could effectively be replaced
by two other fields:
c::Matrix{T}
ap::Matrix{T}
Would that be an easier way to work with them as uninitialized fields? If
so, why?