The subject says it all: it looks like one can override promote_op to 
support the following behaviour:

*julia> **import Base.+*


*julia> **immutable Foo end*

WARNING: Method definition (::Type{Main.Foo})() in module Main at REPL[5]:1 
overwritten at REPL[10]:1.


*julia> **+(a::Foo,b::Foo) = 1.0*

*+ (generic function with 164 methods)*


*julia> **Base.promote_op(::typeof(+),::Type{Foo},::Type{Foo}) = Float64*


*julia> **Array(Foo,0) + Array(Foo,0)*

*0-element Array{Float64,1}*


Is this documented somewhere?  What if we want to override /, -, etc., is 
the solution to write a promote_op for each case?

Reply via email to