0

I'm quite baffled by this error:

ERROR: MethodError: no method matching 
correct_field(::Main.Poetry.LoadTemplates.TicketTemplates.myStruct, ::Dict{String, Any})
Closest candidates are:
  correct_field(::Main.Poetry.ContentGen.TicketTemplates.myStruct, ::Any)
  (...)

The problem is that I loaded the structs in LoadTemplates and now I am using a generic function from ContentGen that dispatches on those structs.

How is this usually solved? I guess I can "unmodulate" my Julia files. Or maybe there's a way to chop off all those Main.Poetry... to get just TicketTemplates.myStruct.

Finally, I'd like to know what's behind this design decision and what are the use cases.

1 Answer 1

0

Instead of:

module MyModule
include(“mystructs.jl”)
using .MyStructs
end

I ought to do:

include(“mystructs.jl”)
module MyModule
using Main.MyStructs
end
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.