Why don't more projects use Ruby Symbols instead of Strings?

前端 未结 4 1475
南笙
南笙 2020-12-17 18:29

When I first started reading about and learning ruby, I read something about the power of ruby symbols over strings: symbols are stored in memory only once, while strings ar

4条回答
  •  不知归路
    2020-12-17 19:16

    Symbols are not garbage collected AFAIK, so that might be a thing to watch out for, but except for that they really are great as hash keys.

提交回复
热议问题