On Thu, 28 Apr 2005, Robin Redeker wrote: > I don't think circular references are used that much.
Circular references are useful any time you need to be able to iterate over a collection, and also have to identify which collection a given object is in. This may even be implicit from other requirements, such as: * enforcing that an object may be in at most one collection of objects at a time * instructing an object to detach from its current collection (especially when forcibly destroying the object) In fact I often want BOTH timely destruction AND circular datastructures; for example, I want to hold an object that represents a row in a database, and I don't want to have to care which transaction, table, database or connection it belongs to. But at the other end, the object representing a transaction has to be able to reverse changes to all its component row objects. And when the transaction goes out of scope it needs to be either committed or rolled back. -Martin