Just the opposite =p I don't know what T is, but I'd like to be able work 
with it. For instance, if somebody gives me an Array{Union(T, U)}, where I 
know U but not T, I'd like to be able to return an Array{T}. 

On Thursday, June 11, 2015 at 3:29:02 PM UTC-4, Jameson wrote:
>
> 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] 
> <javascript:>> 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
>>
>

Reply via email to