I understand the theoretical difference between Strings and Symbols. I understand that Symbols are meant to represent a concept or a name or an identifier or a label or a key, a
Another consideration is that "apple".each_char
makes sense, but :apple.each_char
doesn't. A string is an "ordered list of characters", but a symbol is a atomic datapoint with no explicit value.
I'd say that HashWithIndifferentAccess
actually demonstrates that Ruby symbols are fulfilling two different roles; symbols (which are essentially like enums in other languages) and interned strings (which are essentially a preemptive optimisation, compensating for the fact that ruby is interpreted so doesn't have the benefits of an intelligent optimising compiler.)