Equality of Objects, cont'd

Why define == this way, if it creates confusion?

There are occasions where we actually want to check equality of references and not the content of the objects to which the references refer.

An example would be to check whether a linked-listed contains a loop. Lists as values would require tracing out the entire list. However, a list with a loop cannot be traced without making use of the literal reference values, otherwise tracing would take forever.

Next Slide Previous Slide Contents