Maybe this was already fixed for 0.4.6? I've tried the following, 

julia> a = (2,3,4)
(2,3,4)

julia> b = (3,2,4)
(3,2,4)

julia> map(max, a, b)
(3,3,4)

julia> typeof(a)
Tuple{Int64,Int64,Int64}

julia> typeof(b)
Tuple{Int64,Int64,Int64}

julia> typeof(map(max, a, b))
Tuple{Int64,Int64,Int64}

Even if the type inference didn't work for map, the field is annotated as a 
Tuple{Int64, Int64, Int64} so the assigment should either induce a 
conversion or raise an error. 

Regrading the allocations in the latter two lines, they are clear. I'm only 
puzzled by the allocations in the first line (the if line). 

Uri


On Saturday, August 20, 2016 at 7:04:36 PM UTC+3, Erik Schnetter wrote:
>
> Yes, the call to `map` is type-unstable on 0.4, with a return type 
> inferred as `Tuple{Any, Any, Any}`. It seems fine on 0.5.
>
> -erik
>
> On Sat, Aug 20, 2016 at 11:26 AM, Kristoffer Carlsson <[email protected] 
> <javascript:>> wrote:
>
>> That creating a new Element allocates is not strange because it creates 
>> an array. The map call might allocate due to higher order functions not 
>> being optimal in 0.4.
>
>
>
>
> -- 
> Erik Schnetter <[email protected] <javascript:>> 
> http://www.perimeterinstitute.ca/personal/eschnetter/
>

Reply via email to