Multiversal Equality

In this free Scala training video I demonstrate how Multiversal Equality works in Scala 3.

I first show how you can disable equality comparisons using either an import statement or a compiler option. Then, once you have limited the types of equality comparisons you want to allow, I show how to programmatically enable the equality comparisons that you want to allow.

As a result, you can disallow equals comparisons that don’t make any sense to allow, and then you can enable the equality comparisons that do make sense and that you want to allow.