-
Notifications
You must be signed in to change notification settings - Fork 250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changed meaning of .+= in Julia 0.5 #864
Comments
Similarly for |
I missed this issue and didn't know how my changes fixed the problem. Thanks! :) There are two occurances of this left, both are:
I think this is fine? |
@shashi, I don't quite see what problem your changes fixed. (In 0.6, the |
Ah, the error was: ERROR: LoadError: MethodError: Cannot `convert` an object of type Float64 to an object of type Gadfly.Stat.Identity
This may have arisen from a call to the constructor Gadfly.Stat.Identity(...),
since type constructors fall back to convert methods.
in macro expansion at ./broadcast.jl:129 [inlined]
in macro expansion at ./simdloop.jl:73 [inlined]
in macro expansion at ./broadcast.jl:123 [inlined]
in _broadcast!(::Type{Gadfly.Stat.Identity}, ::Array{Float64,1}, ::Tuple{Tuple{Bool}}, ::Tuple{Tuple{Int64}}, ::Tuple{Array{Float64,1}}, ::Type{Val{1}}) at ./broadcast.jl:117
in broadcast!(::Type{T}, ::Array{Float64,1}, ::Array{Float64,1}) at ./broadcast.jl:172
in apply_statistic(::Gadfly.Stat.ViolinStatistic, ::Dict{Symbol,Gadfly.ScaleElement}, ::Gadfly.Coord.Cartesian, ::Gadfly.Aesthetics) at /home/shashi/.julia/v0.5/Gadfly/src/statistics.jl:1683
... I now see how this happens... It looks like this syntactic transform just places the identifier Maybe the parser should expand it to |
@shashi, good catch, I'll submit a PR to Julia ASAP. |
Thanks! I tried editing the scheme file, but couldn't get it to work with (edit: vimium clicked on comment and close before I was finished. I'll let this remain close) |
Your test code uses
x .+= y
, so you should know that in Julia 0.5 this has changed meaning to be equivalent tobroadcast!(identity, x, x .+ y)
, so that it mutates thex
array (see JuliaLang/julia#17510 … in Julia 0.6 the whole operation will occur in-place without temporaries). So.+
should only be used if the left-hand side is a mutable array, and you don't mind mutating it.At first glance, this looks like it is okay for you, because you use it in
data .+= stat.range * (rand(rng, length(data)) - 0.5) .* span
, wheredata
seems like an array that you don't mind mutating. But if it were a problem you could always change it to+=
.The text was updated successfully, but these errors were encountered: