Closed
Description
At the moment, the result's element type of broadcast
is determined in a straight-forward way by typejoin
ing the type of all the result's elements. (Exception: The empty case, where inference is invoked.) However, for certain operations, the more elaborate mechanism of promote_op
is used, which especially aims at doing magical stuff if the input arrays have non-leaf element types. E.g.
julia> x = ones(Real, 1)
1-element Array{Real,1}:
1
julia> x .+ x
1-element Array{Int64,1}:
2
julia> x + x
1-element Array{Real,1}:
2
While the behavior of +
here does look useful, I wonder whether it is worth the inconsistency and the effort. I tend to say no, but before starting any real work on the issue, I'd like some feedback.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment