When faced with a situation where you may need mutually recursive types like this:
mutable struct MyAgent <: AbstractAgent
id::Int
friendB :: AbstractAgent # will always be AgentB type though
#other fields
end
mutable struct AgentB <: AbstractAgent
id::Int
friendA :: AgentA
# etc
end
Is the internal constructor idiom still the recommended approach? (as described here: Mutually recursive type - General Usage - Julia Programming Language ) or would it be better to use use integers and look up the object from a collection when needed? (ECS-like style). Better means “more idiomatic” and “more performant”.