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 constructors behave the same way, but 
`Bar` turns to ignore inner constructor definition: 

julia> methods(Foo)
 3-element Array{Any,1}:
  call(::Type{Foo}) at /home/<username>/work/playground/contructors.jl:5
  call{T}(::Type{T}, arg) at essentials.jl:56
  call{T}(::Type{T}, args...) at essentials.jl:57


 julia> methods(Bar)
 2-element Array{Any,1}:
  call{T}(::Type{T}, arg) at essentials.jl:56
  call{T}(::Type{T}, args...) at essentials.jl:57

Is it a bug or a feature and how to make `Bar` recognize inner constructor 
(outer constructor is not an option here since it uses type parameter `T` 
in constructor body, but not in its constructor)?

Reply via email to