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. :^)
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:
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: