In every Ruby program Symbol
:x (where x is any characters sequence allowed to be used as a name for a Symbol
) has the same object_id
.
The same thing is with false/true/nil.
I wonder - why is that? Does it mean that every time Ruby initialise all these objects before code is executed (like false/true/nil)? <--- Already answered here: How does object_id assignment work?
And what about Symbols
? Are these initialised also? A millions of possible combinations? How is it possible that their .object_id are the same between programs.