Skip to content
This repository has been archived by the owner on May 21, 2022. It is now read-only.

Changed meaning of .+= in Julia 0.5 #7

Closed
stevengj opened this issue Jul 21, 2016 · 1 comment
Closed

Changed meaning of .+= in Julia 0.5 #7

stevengj opened this issue Jul 21, 2016 · 1 comment

Comments

@stevengj
Copy link

Your code uses x .+= y, so you should know that in Julia 0.5 this has changed meaning to be equivalent to broadcast!(identity, x, x .+ y), so that it mutates the x 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 y .+= noise .* f_rand(n), where y seems like an array that you won't mind mutating. But if it were a problem you could always change it to +=.

@Evizero
Copy link
Member

Evizero commented Aug 13, 2016

Thanks for checking the code and pointing this out. (I did read and check this a while ago but never took the time to say thank you. better late than never I suppose)

@Evizero Evizero closed this as completed Aug 13, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants