# How to define \`:(==)\` on user-defined types for \`Set\` operations

**URL:** <https://discourse.julialang.org/t/how-to-define-on-user-defined-types-for-set-operations/126391>\
**Category:** General Usage\
**Tags:** sets\
**Created:** [February 27, 2025, 4:27pm UTC](https://discourse.julialang.org/t/how-to-define-on-user-defined-types-for-set-operations/126391 "2025-02-27T16:27:08Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [February 27, 2025, 4:30pm UTC](https://discourse.julialang.org/t/how-to-define-on-user-defined-types-for-set-operations/126391/2 "2025-02-27T16:30:28Z")

</div>

That second topic — [Create a user-type set](https://discourse.julialang.org/t/create-a-user-type-set/75420) — is exactly your situation. The mutability is irrelevant here. When you re-define [`==`](https://docs.julialang.org/en/v1/base/math/#Base.:==), you must also symmetrically redefine [`hash`](https://docs.julialang.org/en/v1/base/base/#Base.hash).

---

_[View the full topic](https://discourse.julialang.org/t/how-to-define-on-user-defined-types-for-set-operations/126391)._
