Hacker News new | past | comments | ask | show | jobs | submit login

I don't know where you're getting this idea that equality only makes sense on numbers. In set theory for example, {a,b} equals {a} union {b}, we don't say it is "identical to" or "equivalent to", it IS the same thing. But we don't necessarily need to define an ordering on sets; the equality makes sense without the notion of sorting.



Aye, you've caught me. Let me rein myself in, then: equality makes sense for value objects only (as value objects have no sense of separate identity; for value objects A and B to be equivalent means that they're also a singular entity.)

That's still a minority of the objects we deal with in programming, though, and again, there's no reason to say "equals" when you can specify "is equivalent to" or "is identical to" instead; value objects will happily give you your expected answer under either comparison, and it will force you to define the comparison for business/model objects (that is, those with IDs) as well.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: