If I have a parameterized type Foo{X,Y}
, how can I define a constructor for Foo{X}
that assigns a default value to Y
?
For example, the following didn’t work:
julia> type Foo{X,Y}; end
julia> (::Foo{X}){X}() = Foo{X,true}()
julia> Foo{Int}()
ERROR: MethodError: no method matching Foo{Int64,Y}()
Closest candidates are:
Foo{Int64,Y}{T}(::Any) at sysimg.jl:53