Reputation: 934
How would I resolve something like this:
type Foo
x::Goo
end
type Goo
y::Foo
end
I feel like this is a compile vs run-time issue, is there a way to pre-declare types so that the interpreter/compiler/whatever doesn't throw a LoadError?
Upvotes: 1
Views: 203
Reputation: 11644
One way is to use an abstract type
abstract GooLike
type Foo
x::GooLike
end
type Goo <: GooLike
y::Foo
end
or parametric version
type Foo{T<:GooLike}
x::T
end
There is an open issue (as of the 2014-08-08) about circular dependencies.
Upvotes: 3