On Tue, Sep 16, 2008 at 4:26 AM, Stéphane Payrard <[EMAIL PROTECTED]> wrote:
> I don't understand how = differs with that semantic from :=
> I would expect that = would make a copy (clone?) of the object.

Assignment does copy the value between two containers, but in this
case, the value just happens to be a reference to an object.  Binding
makes another name refer to the same container (not the same value).

Imagine that some college roommates have a keyrack near their door
where they keep their car keys, each hook labeled with the occupant
whose key goes there (maybe at the insistence of one particularly OCD
roommate).   Mary's car goes into the shop, but her schedule is such
that she can use John's car when he doesn't need it, so for a while
John and Mary are driving the same car.  If she gets a copy of his key
and puts it on her own hook, that's like assignment.  If she just
peels the label off her hook and moves it next to his hook, that's
like binding.  Either way she's referencing the same object (driving
the same car), but the key copy is a more flexible arrangement.


Reply via email to