3 ms·
I think the issue only exists for "value" types anyway. Reference equality works perfectly well for all types where I've used inheritance.
by wvenable 6y ago
I think the issue only exists for "value" types anyway. Reference equality works perfectly well for all types where I've used inheritance.
- taeric 6y agoReference equality's inability to survive a persistence round trip is the big killer. And sneaking in a round trip in a process that used to be fully in memory is where dragons lurk.
- wvenable 6y agoEquality is the least of your problems if you multiple instances of the same entity floating around.
- taeric 6y agoSometimes you are seeing if a constructed instance equals an existing one. I would presume that is rather common. Especially with points, a basic collision system is often basically an equality check. Right?
- wvenable 6y agoA "point" would be a value type and you wouldn't use reference equality or inheritance for a value type. But if this were a game you might have a "BigBoss" instance than inherits from "Enemy". If you had one boss, you'd only have one instance of it, and you would use reference equality. If you round-tripped and ended up with 2 instances of the same boss then you're already in trouble.