That’s another example of Julia trying to be perfect. If a similar effort is being exerted to make it simple, Julia can place itself in the Top 5 list in just a few years. Before 0.7, this question wouldn’t have been asked. I mentioned this point in a previous long thread.
Past century languages allowed A + 1 by default without complaining. Fortran, Matlab, R, Numpy, APL, Perl, and others were created and used by genius mathematicians and no one, AFAIK, complained about adding a scalar to an array. My comment may seem negative but I love Julia and I try to be honest. These tiny perfections can accumulate and yield a perfect language that no one likes to use. The moral of the story? Simplicity, simplicity, simplicity, and putting the end-user in focus, always choosing the good approximation approach.
It may surprise you (based on your apparently dim view of our decision making process), that the deprecation of A + 1 was not done just to annoy people and be pedantic, but with careful deliberation for mathematical reasons. Mathematicians tend to like + to be associative, which was no longer the case when A + 1 with Matlab-like behavior was allowed in combination with uniform scaling objects (I)—a uniquely Julian and very powerful feature. (It is left as an exercise for the reader to figure out how this causes associativity to fail or to find the issue where this decision was made.) In the showdown between A + 1 and A + I the former loses out because broadcasting behavior for scalars is not really mathematically sound: in generic code A + 1 should really behave the same as A + I instead of like A + ones(n,n) because I Is the multiplicative identity for arrays, not ones(n,n). The broadcasting behavior of + really only makes sense in the old Matlab (et al.) mindset where vectorization is necessary for performance, a view point that is neither mandatory nor even beneficial in Julia.
I tend to agree with you that double dot might be too much syntax, and Julia needs to be careful not to introduce too much syntax. But dot broadcasting is a bad example to use.
My R using colleagues love Julias dot broadcasting. It’s so much clearer what is actually happening, and so much more powerful because the math is explicit and correct.
julia> function bc(f::Function, n::Int)
if n > 1
bc(f, n-1)
elseif n == 1
(args...) -> f.(args...)
else
throw("n must be a positive integer")
end
end
bc (generic function with 2 methods)
julia> bc(+, 2).([[1,2],[3,4]], 1)
2-element Array{Array{Int64,1},1}:
[2, 3]
[4, 5]
ie. the depth you need to broadcast is just specified by n. If the recursion is worrisome, perhaps using foldl is the way to go.