On Jun 26, 2004, at 8:58 PM, Shashank Date wrote:
> What does the method "delete" on Lines 234, 235 do:
>
> <snip>
>
>  def remove_thyself
>   @@all.delete(self)
>   delete @@lookup[@o1][@o2] if @@lookup[@o1]
> #^^^^^
>   delete @@lookup[@o2][@o1] if @@lookup[@o2]
> #^^^^^


Heh...oops. :)

Apparently I got confused in the middle of converting from JS to Ruby.
(In my app I never actually used remove_thyself, so it wasn't been 
tested.)

Thanks for pointing that out. The correct code should be:

@@lookup[@o1].delete(@o2) if @@lookup[@o1]
@@lookup[@o2].delete(@o1) if @@lookup[@o2]

(or, if you like:
@@lookup[@o1] && @@lookup[@o1].delete(@o2)
@@lookup[@o2] && @@lookup[@o2].delete(@o1)
)


and has been updated to match.

(The 'delete' statement in Javascript removes a property from an 
object.)


--
(-, /\ \/ / /\/