4 ms·
You're partly right. Fixnums don't have a metaclass (or virtualclass) because they're actually "immediate". So you can't say 123.extend(Something) because 123 i
by judofyr 17y ago
You're partly right. Fixnums don't have a metaclass (or virtualclass) because they're actually "immediate". So you can't say 123.extend(Something) because 123 isn't really a full Object.
- wycats 17y agoThat's just to say that there aren't multiple "2"s. But 2 itself is still an object, pointing at its Fixnum class, which has all the normal Class and Object semantics.
- tptacek 17y agoFixnums have a different representation in the interpreter (at least in 1.8 MRI) than normal objects do, which is probably what tripped me up here.
- wycats 17y agoYeah. Conceptually, you can think of the difference as whether or not there can be two copies of something. There can only be one copy of a Symbol, Fixnum, true, false, and nil. This means that true == true, and true.dup #=> error.