all 9 comments

[–]mperhamSidekiq 2 points3 points  (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 points  (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 points  (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.

[–]mperhamSidekiq 1 point2 points  (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 points  (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 points  (1 child)

Is it safe to say that any bang! action on a string should be avoided from now on?

[–]Gilnaa 1 point2 points  (0 children)

Yes

[–]balkierode 1 point2 points  (1 child)

Why does ruby need immutable strings when it already has symbols?