The inner constructor only has a zero-argument method:

julia> Foo{Int}()
Foo{Int64}(0)


If you add a second inner constructor method, then you can call it.

On Tue, Feb 10, 2015 at 12:15 PM, Michael Francis <[email protected]>
wrote:

> A slightly simplified example, If I pin the type parameter I am unable to
> create the new object. I'm sure I'm missing something obvious here but
> given that Int 1 defaults to Int64 on my system I would expect both lines
> to work ?
>
> abstract Bar
> type Foo{T} <: Bar
>   t::T
>   Foo() = new( zero( T ) )
> end
> Foo{T}( d::T) = ( this = Foo{T}() ; this.t = d; this )
>
> Foo{Int}( 1)    # Foo{Int64} has no method matching Foo{Int64}(::Int64)
> Foo( 1)         # Works
>

Reply via email to