Dispatch function based on value of parametric type

You could validate in an inner constructor:

struct BustedType2{B,S}
    function BustedType2{B,S}() where {B,S}
        (isa(B,Bool) && isa(S,Integer)) || error("bad params")
        new()
    end
end
5 Likes