★ is not an operator

★ is U+2605, “black star”, in Unicode category So (Symbol, other).

For the most part (with the exception of some arrows), Julia only parses a subset of category Sm (Symbol, math) as infix operators.

In particular, you should look at U+22C6 (“star operator”), typed by tab-completing \star in the REPL, which is in category Sm and is parsed as an infix operator:

julia> ⋆(x,y) = 2x+y
⋆ (generic function with 1 method)

julia> 3 ⋆ 4
10

(Unfortunately, in many fonts, is shown rather small.)

7 Likes