Hi,

I'm writing a module inside which I want to define a function for two 
different types T1 and T2 that are defined outside the module, and there is 
no relation available (they are not subtypes of another type...).
How could I write only one function instead of having code duplication?

Currently, my code is as follows:

function myf{T1}(x::T1)
...
end

function myf{T2}(x::T2)
...
end

I'd like a mechanism similar to:

function myf{T <: Real}(x::T)
...
end

Ideally something like (I know this doesn't work, that's just the idea):

function myf{T in [T1, T2]}(x::T)
...
end

Is such a thing possible?

Many thanks.

Reply via email to