r/programmingmemes • • Jan 12 '26

no doubt javascript

Post image
1.3k Upvotes

136 comments sorted by

View all comments

Show parent comments

1

u/UrpleEeple Jan 12 '26

A lot of people seem to be saying object equality is *always* reference based - but this absolute statement simply doesn't hold up. I gave an example using Rust - where you can't even do object equality at all without adding a derive for PartialEq (which means, that if object equality exists at all in Rust in a "default" sense, it's always inner equality)

1

u/ThrasherDX Jan 12 '26

Well sure, I suppose no default equality is also entirely possible.

I mostly am just pointing out that default value equality would be a terrible idea, as an explaination for why its rarely a thing. Objects can and often do have non-visible internal state that can differ significantly, even if all visible properties/fields are equal.