Re: [julia-users] Inner constructor in a type with type parameters

2015-10-12 Thread Andrei Zh
Ah, that was obvious. Example of why late night coding isn't very productive :) Thanks! On Monday, October 12, 2015 at 2:15:02 AM UTC+3, Yichao Yu wrote: > > On Sun, Oct 11, 2015 at 6:54 PM, Andrei Zh > wrote: > > I didn't know about such capability, thanks. But I still can't figure > out >

Re: [julia-users] Inner constructor in a type with type parameters

2015-10-11 Thread Yichao Yu
On Sun, Oct 11, 2015 at 6:54 PM, Andrei Zh wrote: > I didn't know about such capability, thanks. But I still can't figure out > how to call this constructor. E.g.: > > julia> Bar{Int}() > ERROR: MethodError: `convert` has no method matching > convert(::Type{Bar{Int64}}) > This may have arisen fr

Re: [julia-users] Inner constructor in a type with type parameters

2015-10-11 Thread Andrei Zh
I didn't know about such capability, thanks. But I still can't figure out how to call this constructor. E.g.: julia> Bar{Int}() ERROR: MethodError: `convert` has no method matching convert(::Type{Bar{ Int64}}) This may have arisen from a call to the constructor Bar{Int64}(...), since type con

Re: [julia-users] Inner constructor in a type with type parameters

2015-10-11 Thread Yichao Yu
On Sun, Oct 11, 2015 at 5:57 PM, Andrei Zh wrote: > Let's consider 2 types with inner constructors: > > type Foo > x::Array{Int,1} > > > Foo() = Foo(zeros(Int, 10)) > end > > type Bar{T} > x::Array{T,1} > > > Bar() = Bar(zeros(T, 10)) > end > > The only difference between them is t

[julia-users] Inner constructor in a type with type parameters

2015-10-11 Thread Andrei Zh
Let's consider 2 types with inner constructors: type Foo x::Array{Int,1} Foo() = Foo(zeros(Int, 10)) end type Bar{T} x::Array{T,1} Bar() = Bar(zeros(T, 10)) end The only difference between them is that `Bar` has type parameter while `Foo` doesn't. I'd expect their inner con