On 9/29/07, Austin Z. [email protected] wrote:
On Sep 29, 2007, at 1:16 PM, SpringFlowers AutumnMoon wrote:
object. But if you move the sticky note, you’re changing the object to
which it references. Since they’re labels, the sticky notes don’t
contain anything – they just name the object that they’re attached to.
Since they don’t contain anything, no other sticky note can point to
another sticky note.
And moving a sticky note to another object leaves any other sticky
notes where they are.
A Ruby variable is nothing like a C++ variable. Never has been, never
(Don’t think that Symbols are special, either. They’re not. Ruby just
keeps a list of all sticky notes that were ever created so you can,
within a certain scope and context, see if the objects you want know
anything about those particular sticky notes. It’s sort-of a master
index, that way. But it’s not magic. It’s how you use them that’s
There’s nothing special in this regard about immediate objects like 0,
99, nil, true… either. You can stick as many post-it notes on these
as you want, even though there’s only one of each.
The technical name for what these post-it notes ‘hold’ is an object
reference. It’s an opaque value which the implementation can use to
‘finger’ a particular object. This shouldn’t be confused with the
object id which you might think of as a unique serial number magically
stamped onto each object.
And as I pointed out on another thread today, if you think of the
parameter passing mechanism as neither call by value, or call by
reference, but as call by object reference it might clarify things.
On 9/29/07, Morton G. [email protected]ain.invalid wrote:
[*] Betrand Meyer of Eiffel fame has often made fun of C++'s reference
semantics. He has claimed they are beyond the understanding of mere
mortals. He is joking, of course.
No, he’s not. Bjarne is clearly not a mere mortal. Or from the upper
At some early OOPSLA (late 1980s/early 1990s) Apple was showing off
their new C++ compiler for the Macintosh Programmers Workshop.
Stroustrup was strolling through the exhibits and wandered into the
Apple booth. One of the Apple guys grabbed him and proudly showed him
that Apple now had a C+ compiler.
Bjarne stood at the computer and typed in a little “Hello world” C++
After about 3 or four tries HE finally got all of the syntax errors
out of his trial program, and this wasn’t due to bugs in Apple’s
My blog on Ruby