4 ms·
> In Ruby 2.2, symbols will be garbage collected like all other Ruby objects This sounds like it must be an oversimplification. What benefit do symbols have ov
by eloisius 12y ago
> In Ruby 2.2, symbols will be garbage collected like all other Ruby objects
This sounds like it must be an oversimplification. What benefit do symbols have over strings, other than immutability? I thought their persistence in memory was a main selling point for using them as hash keys, for instance.
- markcampbell 12y agoI don't think persistence in memory was the selling point. The other selling point is that doing comparisons are faster because `:a == :a` can compare on a memory address while `'a' == 'a'` requires comparing the data at the different memory addresses. Someone tell me I'm wrong.