It should be noted that this is an issue with circular dependencies and 
isn't specific to Julia at all. Sam's suggestions apply to software 
engineering in general, and not just this particular scenario.

On Friday, March 6, 2015 at 5:30:13 PM UTC-5, Kristoffer Carlsson wrote:
>
> If I have a function that uses two types as argument do I have to declare 
> both types before defining the function?
>
> I think an example will make my question clearer.
>
> Say I want the following structure of a package:
>
> #Package.jl
> module Package
> export f, g
> include("foo.jl")
> include("bar.jl")
> end
>
> #foo.jl
> type foo end
>
> f(arg1::foo, arg2::bar)
>     yadda yadda
> end
>
> #bar.jl
> type bar end
>
> g(arg1::foo, arg2::bar)
>    yadda yadda
> end
>
>
>
> This will not work because when f is declared, bar is not defined.
>
> Is there anyway I can solve this without moving both type declarations to 
> a separate file and including that first?
>

Reply via email to