btw, why don't constraints get handled by an outer constructor in the first place?
It makes sense to have inner constructors for unitialized On Tuesday, February 4, 2014 11:23:51 PM UTC-5, milktrader wrote: > > Thanks John, I finally figured it out after hacking around for a couple > hours. It's not intuitive, that's for sure! > > On Tuesday, February 4, 2014 10:57:52 PM UTC-5, John Myles White wrote: >> >> Yup, this is one of the quirkier things about parametric types. You need >> to echo the inner constructor as an outer constructor. >> >> — John >> >> On Feb 4, 2014, at 7:37 PM, milktrader <[email protected]> wrote: >> >> > julia> immutable Foo{T,N} >> > x::Vector{Int} >> > y::Array{T,N} >> > z::Vector{ASCIIString} >> > >> > function Foo(x::Vector{Int}, y::Array{T,N}, >> z::Vector{ASCIIString}) >> > new(x,y,z) >> > end >> > >> > end >> > >> > julia> foo = Foo([1], [2], ["bar"]) >> > ERROR: no method Foo{T,N}(Array{Int64,1}, Array{Int64,1}, >> Array{ASCIIString,1}) >> > >> > Without the inner constructor, an object is created no problem. >> >>
