Struct/method definition order advice

The idea that methods belong to types is much less clear in Julia than in OOP languages. I tend to think of generic functions as interfaces that get implemented, i.e., have methods, by different types and usually end up with something like the following structure:

  • interface_*.jl : Files containing interface defnitions, i.e., forward declarations of generic functions with docstrings describing their intend.
    Reading these files allows to see the abstract functionality at once.

  • type_*.jl: Files containing type declarations.
    Again, reading these files allows to see supported data types and their layout.

  • implementation_*.jl: Files containing the actual methods for each interface and type combination.
    Finally, I can dig into the implementation here if needed.

In practice the filenames would be more meaningful though, i.e., in your game example the files might be game.jl (for the interfaces), agents.jl(for the types) and game_play.jl (for the implementations) or something like that.
In simpler case, i.e., if a method only depends on a single type, it can also implement directly just after the type definition. Similarly, a generic function with a single method can be defined just at its point of use.
In any case, the capture(::Player, ::Monster) and foo(::LowerType, ::HigherType) methods belong neither to one nor the other type, i.e., they specify an interaction between types and should be handled accordingly.