# Weird error when trying to use \`≔\` (\\coloneq) as infix operator

**URL:** <https://discourse.julialang.org/t/weird-error-when-trying-to-use-coloneq-as-infix-operator/21578>\
**Category:** General Usage\
**Tags:** infix\
**Created:** [March 7, 2019, 3:24pm UTC](https://discourse.julialang.org/t/weird-error-when-trying-to-use-coloneq-as-infix-operator/21578 "2019-03-07T15:24:08Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [August 27, 2025, 11:16am UTC](https://discourse.julialang.org/t/weird-error-when-trying-to-use-coloneq-as-infix-operator/21578/3 "2025-08-27T11:16:53Z")

</div>

> [@simeonschaub](#):
>
> Is this even supposed to work?

I believe you can only use it as an infix operator in a macro. It _is_ parsed as an infix operator:

```julia-auto
julia> dump(:(2 ≔ 3))
Expr
  head: Symbol ≔
  args: Array{Any}((2,))
    1: Int64 2
    2: Int64 3

```

with assignment precedence, but you can’t overload assignment operators. The 1.13 parser gives a more descriptive error:

```julia-auto
julia> 3 ≔ 2
ERROR: syntax: unsupported assignment operator "≔"
Stacktrace:
 [1] top-level scope
   @ REPL[4]:1

```

However, since it is parsed, you can write a macro that rewrites it into something else. You can do the same thing with `:=`.

```julia-auto
julia> dump(:(2 := 3))
Expr
  head: Symbol :=
  args: Array{Any}((2,))
    1: Int64 2
    2: Int64 3

julia> Base.operator_precedence(:(=))
1

julia> Base.operator_precedence(:(:=))
1

julia> Base.operator_precedence(:(≔))
1

```

See also [Is it possible to overload `:=`?](https://discourse.julialang.org/t/is-it-possible-to-overload/95547)

PS. Whoops, I didn’t realize that this was an ancient thread.

---

_[View the full topic](https://discourse.julialang.org/t/weird-error-when-trying-to-use-coloneq-as-infix-operator/21578)._
