As far as I understand it, “b” is an instance/object of a class, and
they are both object instances of Fixnum (b.class, a.class).
So when you create “b”, it creates a new Fixnum object with the value of
“a”, 3 in this instance, and that object is independent from “a”. You
are just using “a” to pass an argument to the new Fixnum object.
You can try the same with String, i.e. a=“a” and b=a, etc.
I guess what I’m driving at is that “a=b” doesn’t declare “relationship”
between the two objects, as algebra would, rather just a “shortcut” of
creating new Fixnum object “b” by using the current value of “a”.
Maybe your confusion comes from the fact that “a” and “b” are objects,
not variables? With variables, you can achieve what you are looking for:
then both @@a and @@b will equal 4.
Or (maybe) even simpler explanation, by rewriting your post:
a = 3
=> a is creating new “number object 3”
b = a
=> b is creating new “number object 3”