I have the following parametric type newInt
, which works, but adding an inner constructor that fills in certain fields causes errors:
struct newInt{U,V}
u::U
v::V
n::DataType
end
julia> newInt(10,"a",String)
newInt{Int64,String}(10, "a", String)
struct newInt2{U,V}
u::U
v::V
n::DataType
newInt2{U,V}(u::U,v::V) where {U,V} = new(u,v,typeof(v))
end
julia> newInt2(10,"a")
ERROR: MethodError: no method matching newInt2(::Int64, ::String)