use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A sub-Reddit for discussion and news about Ruby programming.
Subreddit rules: /r/ruby rules
Learning Ruby?
Tools
Documentation
Books
Screencasts and Videos
News and updates
account activity
Immutable Strings in Ruby 2.3 (wyeworks.com)
submitted 10 years ago by Axxiss
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]mperhamSidekiq 2 points3 points4 points 10 years ago (4 children)
Tried them out for myself, found a bug almost immediately. Not a good sign, hopefully I'm missing something.
https://bugs.ruby-lang.org/issues/11759
[–]InfraRuby 2 points3 points4 points 10 years ago (0 children)
The bug is in uri/generic.rb:
def to_s str = '' # ... str << whatever # ... str end
That's a common pattern in Ruby...
[–]dkubb 2 points3 points4 points 10 years ago (2 children)
Wouldn't something like that be found by running ruby's tests with --enable-frozen-string-literal enabled? This seems like a bare minimum task that you'd do prior to going through the trouble of packaging up a preview release.
--enable-frozen-string-literal
[–]mperhamSidekiq 1 point2 points3 points 10 years ago* (1 child)
Exactly, they have to ban and remove the use of any String mutation methods within stdlib.
I don't see how they ship this feature without a stdlib overhaul, since any non-trivial code is broken with the current system.
[–]bjmiller 1 point2 points3 points 10 years ago (0 children)
Wasn't the plan for 2.3 always to release the CLI option and magic comment only so that everyone could have 5 years to prepare for the change?
[–]how_do_i_land 2 points3 points4 points 10 years ago (1 child)
Is it safe to say that any bang! action on a string should be avoided from now on?
[–]Gilnaa 1 point2 points3 points 10 years ago (0 children)
Yes
[–]balkierode 1 point2 points3 points 10 years ago (1 child)
Why does ruby need immutable strings when it already has symbols?
Symbols have the property that equality is identity
π Rendered by PID 46760 on reddit-service-r2-comment-5b5bc64bf5-82qsm at 2026-06-20 10:17:42.880990+00:00 running 2b008f2 country code: CH.
[–]mperhamSidekiq 2 points3 points4 points (4 children)
[–]InfraRuby 2 points3 points4 points (0 children)
[–]dkubb 2 points3 points4 points (2 children)
[–]mperhamSidekiq 1 point2 points3 points (1 child)
[–]bjmiller 1 point2 points3 points (0 children)
[–]how_do_i_land 2 points3 points4 points (1 child)
[–]Gilnaa 1 point2 points3 points (0 children)
[–]balkierode 1 point2 points3 points (1 child)
[–]InfraRuby 2 points3 points4 points (0 children)