Hi,

I'd like to allow a function to take arguments that consist of arrays of a 
type I've defined, or empty arrays. In many languages, one can do this 
using option types; is there an analogue in julia?

Concretely, I'd like to define T so that the last typeassert here will be 
true:

julia> type MyType
           value
       end

julia> T=Union(MyType,None)
MyType (constructor with 1 method)

julia> [MyType(4)]::Array{T}
1-element Array{MyType,1}:
 MyType(4)

julia> []::Array{T}
ERROR: type: typeassert: expected Array{MyType,N}, got Array{None,1}

Thanks!
Madeleine

Reply via email to