So here is the code I have
abstract AbstractNode
type Edge
source::AbstractNode
target::AbstractNode
Edge(source::AbstractNode, target::AbstractNode) = new(source, target)
end
type Node <: AbstractNode
edgeList::Vector{Edge}
Node() = new([])
end
a = Node()
b = Node()
edge = Edge(a,b)
push!(a.edgeList, edge)
If you run this code then a stores edge which itself stores a. In Python that doesn't cause a problem, but with Julia I enter a recursive loop and get a StackOverFlowError() (shout out! :-)). How do I resolve this?