<div class="gmail_quote">On Tue, Oct 19, 2010 at 5:37 AM, Dave Angel <span dir="ltr"><<a href="mailto:davea@ieee.org" target="_blank">davea@ieee.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


<div><div></div><div> On 2:59 PM, dex wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Using strong references, I have to remove room B from list of rooms,<br>
and also remove door to room B, as it holds reference to room B. To do<br>
that, I have to keep list of doors that lead to room B.<br>
<br>
Using weak references, I don't have to worry about removing all doors<br>
to room B. They all now have a dead reference, which better models<br>
actual situation. If part of mine collapses, or if a module on space<br>
station is destroyed, the passage to that location does not magically<br>
vanish - it's just obstructed.<br>
<br>
Can you please tell me if there's something wrong with my reasoning?<br>
<br>
</blockquote></div></div>
Simply replace room B with a "destroyed room" object.  That can be quite small, and you only need one, regardless of how many rooms are thus eliminated.<br></blockquote></div><br>How does this avoid the problem of having to keep a list of doors that lead to room B?  You can't just replace one object with another.  You would have to replace every reference to B with a reference to the new object.  This is no simpler than deleting the references or replacing them with None.<br>

<br>