Is it possible to redefine a base operator like .* in customer package?

I try to redefine the basic operator like .* for my special variable type, through the code:
import Base: .*
function .*(a, b)
execute some behavior.
end

I get a warning message of “could not import Base…* into Main”. Is it possible to redefine a base operator like .* in customer package?

.* is not an operator. * is an operator, and . brings it into the broadcast system which is documented at:

https://docs.julialang.org/en/v1/manual/interfaces/#man-interfaces-broadcasting

1 Like

Thank you very much! I found the answer like this:
If Base.Broadcast.broadcasted( , x :: Float64, y :: String) = y[1] was defined, then
1.0 .
“st” = “s”.
That is my expected behavior!

1 Like