In 0.3 it's not possible in 0.4 this works:
julia> type A{T,P}
a::T
end
julia> typealias B{T} A{T, 1}
A{T,1}
julia> call{T}(::Type{B}, a::T) = B{T}(a)
call (generic function with 936 methods)
julia> B(1.0)
A{Float64,1}(1.0)
See https://github.com/JuliaLang/julia/pull/8712 for discussion
call-overloading.
On Tue, 2015-04-07 at 20:26, Kristoffer Carlsson <[email protected]> wrote:
> Let's say I have a type parameterized with two other types and I do the
> following:
>
> type A{T,P}
> a::T
> end
>
> typealias B{T} A{T, 1}
>
> B(1.0) # Error
>
> B{Float64}(1.0) # Works
>
> Is there anyway you could write the code so that the T type is inferred
> from the argument to the call to B.
>
> Best regards,
> Kristoffer Carlsson