[julia-users] Short question about type alias with partially known parameter types

2015-04-07 Thread Kristoffer Carlsson
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

Re: [julia-users] Short question about type alias with partially known parameter types

2015-04-07 Thread Mauro
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

Re: [julia-users] Short question about type alias with partially known parameter types

2015-04-08 Thread Kristoffer Carlsson
Thank you for the code and the pull request link. Very interesting. On Tuesday, April 7, 2015 at 8:55:34 PM UTC+2, Mauro wrote: > > 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}(