From: Lloyd Zusman Date: 2002-09-24T09:23:14+09:00 Subject: Re: self as method argument revisited "Gray, Jeff" writes: >> From: dblack@candle.superlink.net [mailto:dblack@candle.superlink.net] >> >> A while ago transami brought up the question of an object needing >> access to the object that created it, and there was discussion of >> techniques including sending self as an argument. > > I had my first Ruby epiphany when I was working on a netlisting > tool where I needed to be able to traverse the hierarchy in > both directions. When I wrote the following line of code in the > "add a new block to the hierarchy" method: > > child.parent = self > > the profound, fundamental truth of that statement -- as bad of a > programmer that I might be -- let me know that I was doing something > right. :^) > > Cheers, > > - jeff We're lucky that Ruby doesn't also have a "spouse" keyword, or else then there would be ambiguity, since the following would also be true: child.parent = spouse :) -- Lloyd Zusman ljz@asfast.com