folks, just out of curiosity, how does equality checks work in Roc? does in-place mutation affects that in any way? (maybe this question is more of a dummy question related to any immutable languages but hopefully I can nerdsnipe someone to explain it a bit :grinning_face_with_smiling_eyes:)
kind of maybe? we have less sharing than e.g. elm would have, in general
so generally what we do is structural equality, and sometimes you can just compare pointers (references) and if they are the same then they must point to the same thing
is the approach to always do pointers and then fallback to structural equality? (unless dealing with primitive types?
would equality checks inside a clojure automatically break the possibility of in-place mutation in that same clojure? since then a pointer value would not mean equality.
Yes, pretty much. If the pointer equality check fails structural equality is still done. It doesn’t work for equating function types of course
Last updated: Jul 06 2025 at 12:14 UTC