On Mon, 2016-06-20 at 14:06, amik...@gmail.com wrote:
> Hi,
>
> module M
> function f{T1}(x::T1) return x.a end
> function f{T2}(x::T2) return x.b + 1 end
> export f
> end
This should probably read:
module M
function f(x::T1) return x.a end
function f(x::T2) return x.b + 1 end
export f
end
As
Hi,
module M
function f{T1}(x::T1) return x.a end
function f{T2}(x::T2) return x.b + 1 end
export f
end
using M
type T1 a::Float64 end
type T2 b::Float64 end
t1 = T1(1.0)
t2 = T2(2.0)
println(f(t1))
println(f(t2))
This code doesn't work, how can I force the function templated for T1 to be
used