Are you looking for the type-intersection perhaps? julia> typeintersect(Union(Int,Float64), Float64) Float64
On Thu, Jun 11, 2015 at 3:15 PM David Gold <[email protected]> wrote: > I want the following function > > function t_or_void{T}(::Type{Union(T, Void)}) > return T > end > > to work like this: > > julia> t_or_void(Union(Int, Void)) > Int64 > > But in reality, it does this: > > julia> t_or_void(Union(Int, Void)) > UnionType > > Is there a way to make this work, or a way to extract T from Union(T, > Void)? The 'Void' isn't special -- it could be any determinate type. > > Thanks, > D >
