Hi guys,

A few months back I ran into what I thought was a rather annoying design 
decision: if A is an array and b is a number, then A + b is meaningless, 
and if we want to add b to all elements of A individually we need to use A 
.+ b. All of this was discussed in:

https://github.com/JuliaLang/julia/issues/6417

I recently updated my Julia distribution to Version 0.3.0-prerelease+4145 
(2014-07-11 20:48 UTC) and it seems the warning is no longer present, and I 
am allowed to evaluate, for instance, [1,2,3] + 1, and get no error :) Has 
the community decided to change its mind?

To throw in my two cents, the decision to reintroduce Array + Scalar makes 
me very happy! I ran into a simple problem almost straight after A + b was 
deprecated which was extremely annoying to get around: 

I was writing some code which included a function which would take as an 
input the f(u), where u could either be a scalar or a vector (its dimension 
would equal the dimension of a system). If u had to be a vector, then f 
might look like:

f(u) = u[1] + u[2] + 1

And if u were a scalar (the 1D case) it might look like:

f(u) = u + 1.

The problem is that in the code the input to f would be a vector of length 
equal to the system's dimension, and in the 1D case it would be a 
1-dimensional vector. In that case I just want, for instance, f([2]) = [2] 
+ 1 = [3], but it wouldn't let me do this :(. Having to define f(u) = u[1] 
+ 1, or f(u) = u .+ 1, when u is intuitively a scalar (though in the code 
the input is a 1-element array) is unintuitive to say the least. 

Anyway, what's going on with this change?

Thanks

Reply via email to