I'm wondering about the best practices for Union types.  In particular, 
let's say that I have a Union type

typealias RowsType Union(Int, Vector{Int}, Ranges{Int})

I have some functions which takes a parameter with one of these types, say

Base.sub(D::DataFrame, rs::RowsType) = SubDataFrame(D, rs)

My question is, is it better to parameterize this function, as

Base.sub{R<:RowsType}(D::DataFrame, rs::R) = SubDataFrame(D, rs)

Why or why not?

One rule of thumb Jeff has previously mentioned is that it's generally 
unnecessary to parameterize if the type is not used in the function body. 
Does that apply to Union types as well?  What if the rs variable were used 
more frequently in the body of the function? (e.g., if there were something 
like

for x in rs
   # do something
end

Looking for some clarification...

Cheers!

   Kevin

Reply via email to