-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Closed
Labels
types and dispatchTypes, subtyping and method dispatchTypes, subtyping and method dispatch
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.
Metadata
Metadata
Assignees
Labels
types and dispatchTypes, subtyping and method dispatchTypes, subtyping and method dispatch