I have the following (simplified) module structure in my program.
I have also detailed the simplified structure of each module.
module Entities
export Agent, Space
struct Agent
.
end
struct Space
.
end
end
module Loader
export load_data, read_config
include("./entities.jl")
using .Entities: Agent, Space
function read_config(...)
.
end
function load_data(...)::Tuple{Vector{Space}, Vector{Agent}}
.
end
end
module Scheduler
include("./loader.jl")
include("./entities.jl")
using .Loader: load_data, read_config
using .Entities: Agent, Space
function main()
spaces, agents = load_data(read_config("scenarios/eq_2.json"))
synthetise_schedule(agents, spaces, order)
# println(typeof(spaces), "\t", typeof(agents), "\t", typeof(locations), "\t", typeof(order))
end
function synthetise_schedule(agents::Vector{Agent}, spaces::Vector{Space})
.
end
main()
end
Now, when I run the scheduler.jl
file, I get the following error
LoadError: MethodError: no method matching synthetise_schedule(::Array{Main.Scheduler.Loader.Entities.Agent,1}, ::Array{Main.Scheduler.Loader.Entities.Space,1})
It looks like the REPL treat Main.Scheduler.Loader.Entities.*
and Main.Scheduler.Entities.*
as different types, although they eventually all refer to the same original types Entities.*
.
Now, I am not sure if this behavior comes from the fact that I am missing a set of instructions within each module or if it is the expected behavior in Julia.
In any case, how can I make sure that my synthetise_schedule
function accepts Main.Scheduler.Loader.Entities.*
types as input?