Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In Ruby you tend to use :symbol for small immutable strings

<< is inplace append operator for strings/arrays, while + is used to make copy. So += will make new string & rebind variable



I’ll just kill the comment. It said Symbol isn’t garbage collected. It has been since 2.2 and I wasn’t aware. Sorry.

Good reminder that anyone can go on the internet, just say stuff, and be wrong.


Symbols have been GCed since CRuby 2.2 https://bugs.ruby-lang.org/issues/9634


Well thats great, guess I have carried that baggage with me as misinformation for years now.


One of the things I’ve said I would do and never did is create a set of test suites for as many facts about a language as I know and then run it for every new release to see what I need to unlearn.

Most but not all of these were performance related. If it took a few days to run that’s fine. Major versions don’t come out that often.


Same here. Turns out writing too much code for RPG Maker XP when young ruins one’s perception of Ruby forever


dynamically created symbols have been garbage collected for almost 10 years


Yeah I am a moron. Updated.


No. A moron would refuse to learn. You are open minded and humble.


Thank you stranger <3




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: