The ordering of includes isn't your problem. It's that Array{state} is NOT
a subtype of Array{Any} Jeff will be able to explain that reasoning
better than I can. Try:
julia> type state
> x
> y
> z
> end
> julia> s1 = state(1.0, 5.0, 7.0)
> state(1.0,5.0,7.0)
> julia> s2 = state(2.0, 6.0, 8.0)
> state(2.0,6.0,8.0)
> julia> sl = [s1, s2]
> 2-element Array{state,1}:
> state(1.0,5.0,7.0)
> state(2.0,6.0,8.0)
> julia> f(s) = "first version"
> f (generic function with 1 method)
> julia> f(sl)
> "first version"
> julia> f(sl::Array{Any}) = "second version"
> f (generic function with 2 methods)
> julia> f(sl)
> "first version"
> julia> f(sl::Array{state}) = "this is probably what you want"
> f (generic function with 3 methods)
> julia> f(sl)
> "this is probably what you want"
On Thu, Sep 17, 2015 at 8:24 AM, <[email protected]> wrote:
> And of course I can't include my_type.jl before my_module.jl and specify
> the types in the function f(s::state) or f(sl::Array{state}), because in
> the real case I use a lot of things inside my_type.jl from my_module.jl...
>