Wim Jongeneel
Jul 22, 2021

--

No this is totally unrelated to mutable vs immutable. It is just whatever the default implementation of your equals operator happens to be.

Usually languages that enforce immutability will not implement reference comparisons because it makes no sense in such languages. In the same way, languages that work with mutable data will by default compare references because that is way faster and simpler.

But that is just common design philosophy and has nothing to do with anything actual technical.

--

--

Wim Jongeneel
Wim Jongeneel

Written by Wim Jongeneel

Software Engineer at Mendix (Rotterdam, The Netherlands) • Student MSc Software Engineering • Functional programming enthusiast

No responses yet