I know in F# people encourage Discriminated Unions, what about in Julia?

I would like to do the following:

immutable B end
immutable C end

typealias A Union{B,C}

function A(x::Int)
    if x > 0
        B()
    else
        C()
    end
end

But it doesn't work because I cannot add a constructor for union type?

Is Union a preferred way in Julia in this case, or abstract type + 
inheritance is better?

Does union type solves the problem of unstable return type from the 
function at all?

Reply via email to