[julia-users] Re: Help with `promote_op` in v0.5

2016-07-29 Thread j verzani
Thanks!

On Friday, July 29, 2016 at 11:22:47 AM UTC-4, Pablo Zubieta wrote:
>
> This is due to issue https://github.com/JuliaLang/julia/issues/17314, and 
> should get fixed if https://github.com/JuliaLang/julia/pull/17389 gets 
> merged.
>
> On Friday, July 29, 2016 at 5:00:14 PM UTC+2, j verzani wrote:
>>
>> The test for the Polynomials package are now failing in v0.5. Before
>>
>> ```
>> p1  = Poly([1, 2])
>> p = [p, p] # 2-element Array{Polynomials.Poly{Float64},1}:
>> p + 3  # 2-element Array{Polynomials.Poly{Float64},1}:
>> ```
>>
>> But now, `p+3` is an `Array{Any,1}`. I think the solution is related to 
>> how `promote_array_type` uses `promote_op`, which in turn returns `Any` for 
>> `Base.promote_op(:+, eltype(p), eltype(3))`. There is a comment in 
>> promotion.jl about adding methods to `promote_op`, but as `promote_op` 
>> isn't exported this seems like the wrong solution for this case. (As well, 
>> I couldn't figure out exactly how to do so.) I could also fix this by 
>> defining `.+` to directly call `broadcast`, but that defeats the work in 
>> `arraymath,jl`.
>>
>> Any hints?
>>
>

[julia-users] Re: Help with `promote_op` in v0.5

2016-07-29 Thread Pablo Zubieta
This is due to issue https://github.com/JuliaLang/julia/issues/17314, and 
should get fixed if https://github.com/JuliaLang/julia/pull/17389 gets 
merged.

On Friday, July 29, 2016 at 5:00:14 PM UTC+2, j verzani wrote:
>
> The test for the Polynomials package are now failing in v0.5. Before
>
> ```
> p1  = Poly([1, 2])
> p = [p, p] # 2-element Array{Polynomials.Poly{Float64},1}:
> p + 3  # 2-element Array{Polynomials.Poly{Float64},1}:
> ```
>
> But now, `p+3` is an `Array{Any,1}`. I think the solution is related to 
> how `promote_array_type` uses `promote_op`, which in turn returns `Any` for 
> `Base.promote_op(:+, eltype(p), eltype(3))`. There is a comment in 
> promotion.jl about adding methods to `promote_op`, but as `promote_op` 
> isn't exported this seems like the wrong solution for this case. (As well, 
> I couldn't figure out exactly how to do so.) I could also fix this by 
> defining `.+` to directly call `broadcast`, but that defeats the work in 
> `arraymath,jl`.
>
> Any hints?
>