On Friday, July 11, 2014 4:17:49 PM UTC-4, Job van der Zwan wrote: > > So this is an offtopic question inspired by the talk: around the 57th > minute in the second video there's a discussion about + and +=. Although I > didn't hear the question, I assume it was equal to mine: if we had a > separate += operator, then *a += b* could be defined to update the fields > of a, whereas *a = a + b* requires the creation of a new object. Since > "don't generate garbage in the first place" is a good form of memory > optimisation in *any *garbage collected language, that sounds like quite > a legit use-case to me, especially in a language dedicated to number > crunching. >
See the discussion in: https://github.com/JuliaLang/julia/issues/249 https://github.com/JuliaLang/julia/issues/7052 As discussed in #249, this change would make it much harder to write generic code, because the meaning of += could change drastically depending upon the types. As discussed in #7052, this doesn't seem like it will help much in real applications, because real applications tend to be more complicated than a += b, and instead tend to have things like a += 4b - 3c + 2d.^2.