On Feb 23, 3:59=A0pm, Robert Klemme <shortcut... / googlemail.com> wrote:
> On 23.02.2009 22:42, Yossef Mendelssohn wrote:
> > I only pointed it out because there's no way (that I know of) to show
> > that a and b point to the same object at one point if a Fixnum is
> > used. You can use 'hi'.sub!, but there's no 1.succ!
>
> You can use #object_id for that - even for Fixnums. :-)

Good point, though I still stick to my guns and say that showing this
with a different object, like a String, is clearer. Seeing that two
numbers have the same object_id doesn't carry the same weight as
seeing that mutating the value of variable (as in a =3D 'hi'; a.upcase!)
will change the value of another.

Maybe I look at it something like trying to write a failing test
before writing some code. Sure you can show that

  a =3D 3
  b =3D a
  a.object_id =3D=3D b.object_id  # true

But that's not very interesting because 3.object_id =3D=3D 3.object_id.
It's different with strings

  'hi'.object_id =3D=3D 'hi'.object_id  # false
  a =3D 'hi'
  b =3D a
  a.object_id =3D=3D b.object_id  # true

--
-yossef