# Does anybody use the syntax \`a \<operator\> b = ...\` to define new methods for operators?

**URL:** <https://discourse.julialang.org/t/does-anybody-use-the-syntax-a-operator-b-to-define-new-methods-for-operators/83034>\
**Category:** General Usage\
**Tags:** question, syntax\
**Created:** [June 19, 2022, 11:14pm UTC](https://discourse.julialang.org/t/does-anybody-use-the-syntax-a-operator-b-to-define-new-methods-for-operators/83034 "2022-06-19T23:14:27Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![dylanxyz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dylanxyz/32/36646_2.png) [@dylanxyz](https://discourse.julialang.org/u/dylanxyz)\
**Post date:** [June 20, 2022, 3:38am UTC](https://discourse.julialang.org/t/does-anybody-use-the-syntax-a-operator-b-to-define-new-methods-for-operators/83034/8 "2022-06-20T03:38:53Z")

</div>

I pretty sure it will only works for expressions that are parsed as a `call` expression, for example:

```julia
julia> Meta.@dump x * y
Expr
  head: Symbol call
  args: Array{Any}((3,))
    1: Symbol *
    2: Symbol x
    3: Symbol y

julia> Meta.@dump x.y
Expr
  head: Symbol .
  args: Array{Any}((2,))
    1: Symbol x
    2: QuoteNode
      value: Symbol y

```

As you can see, it doesn’t work with something like the `.` operator because is specially parsed. One limitation that i thinked of was the use of `where`, but you can still use it with this syntax if you wrap the expression with parenthesis:

```julia
julia> x::T ± y::T where {T <: Number} = (x + y, x - y)
ERROR: UndefVarError: T not defined
Stacktrace:
 [1] top-level scope
   @ REPL[16]:1

julia> (x::T ± y::T) where {T <: Number} = (x + y, x - y)
± (generic function with 1 method)

julia> 2 ± 3
(5, -1)

```

---

_[View the full topic](https://discourse.julialang.org/t/does-anybody-use-the-syntax-a-operator-b-to-define-new-methods-for-operators/83034)._
