On Thu, 2003-06-12 at 10:14, Rasputin wrote: > * Andrew Walrond <andrew / walrond.org> [030612 15:02]: > > remember that pretty much everything is a reference and you won't go far > > wrong > > I thought so, until this happened! > The array was full of references, so I thought el held the > reference from the Array. I've always felt that thinking about Ruby variables and objects in terms of references was a bad idea. I prefer to think about it in terms of objects and names. You have objects, and you have names that can be bound to objects. In your case, the name el is bound to a particular object. You can modify the binding (by assigning to el), and you can modify the object (by sending it messages that cause it to change state). But to change what the array holds, you must send messages to the array object itself. No need to think about references at all. I wrote a bit about this topic before, so I won't go into it here. You can read my initial posting at http://www.rubygarden.org/ruby?VariablesAndObjects. Thanks. -- -- Jim Weirich jweirich / one.net http://onestepback.org ----------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)