Is there a way to implicitly convert two variables with the same *intrinsic type*

Is there a way to implicitly convert two variables with the same intrinsic type but coming from different modules? see below for example

LoadError: MethodError: no method matching synthetise_schedule(::Array{Main.Scheduler.Loader.Entities.Agent,1}, ::Array{<http://Main.Scheduler.Loader.Entities.Space|Main.Scheduler.Loader.Entities.Space>,1}, ::Dict{String,Array{String,1}})
Closest candidates are:
synthetise_schedule(::Array{Main.Scheduler.Entities.Agent,1}, ::Array{<http://Main.Scheduler.Entities.Space|Main.Scheduler.Entities.Space>,1}, ::Dict{String,Array{String,1}}) 

For instance,
<http://Main.Scheduler.Loader.Entities.Space|Main.Scheduler.Loader.Entities.Space> and <http://Main.Scheduler.Entities.Space|Main.Scheduler.Entities.Space> refer to the same element but for some reason they are not considered the same type.
I don’t export types in any of my modules and sub-modules, but I have the following using statements at the top of my Scheduler module

using .Loader: load_data, read_config
using .Entities: Agent, Space, Event

Note that the original poster on Slack cannot see your response here on Discourse. Consider transcribing the appropriate answer back to Slack, or pinging the poster here on Discourse so they can follow this thread.
(Original message :slack:) (More Info)

You should be importing the shared type from one module, and that module, call it M, should have export Typename (for your Typename) near the top of the file (after the line beginning module). Other modules that want to use that type should have a line using M: Typename near the top of the file (after any export lines).
The example below is as typed into the REPL (hence the dots).

module A
  export MyType

  struct MyType
    x::Int
  end

  # etc
end

module B
   using ..A: MyType
   # etc
end

module C
  using ..A: MyType
  # etc
end

# now they are all the same
using .A: MyType # ok
using .B: MyType # ok
using .C: MyType # ok
2 Likes