-
Notifications
You must be signed in to change notification settings - Fork 30
Eagerly defrost chilled strings #93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Why not add a new predicate function for chilled strings? |
We could do it indeed. My intent was for them to eventually go away in a future, so I wasn't thinking of adding a predicate on What were you thinking of? |
6982d03
to
404d2c4
Compare
Ref: https://bugs.ruby-lang.org/issues/20205 One minor backward compatibility issue with chilled strings is that since they claim to be frozen, code using the pattern: ```ruby StringIO.new("") ``` Is now producing read only `StringIO` instances. It would be preferable to emit a warning instead. We can detect whether the current Ruby produce chilled strings and if so preemptively attempt to mutate the given string to produce the warning immediately and preserve the original behavior.
404d2c4
to
8363ac3
Compare
There is a ridiculous amount of warnings from Ruby 3.4 chilled strings, and also a few errors because of StringIO incompatibility, see ruby/stringio#93 I'm not comfortable setting this to anything else than false. This at least fully keeps the current behaviour
There is a ridiculous amount of warnings from Ruby 3.4 chilled strings, and also a few errors because of StringIO incompatibility, see ruby/stringio#93 I'm not comfortable setting this to anything else than false. This at least fully keeps the current behaviour
Adding stringio/ext/stringio/extconf.rb Lines 3 to 7 in 779f713
It might be possible to still require the stdlib stringio but that's a bit messy: Alternatives I can think of:
|
How about exposing an optional predicate for C extensions? Like |
What I thought is same as @eregon, “a predicate function”, not “method”. |
Or |
There is a ridiculous amount of warnings from Ruby 3.4 chilled strings, and also a few errors because of StringIO incompatibility, see ruby/stringio#93 I'm not comfortable setting this to anything else than false. This at least fully keeps the current behaviour
The suggested implementation is at #94, but depends on ruby/ruby#10355. I suppose |
I'm not sure, but given the circumstances waiting for a dev meeting decision seems quite long. |
Closing in favor of #94. |
Ref: https://bugs.ruby-lang.org/issues/20205
Fix: #92
One minor backward compatibility issue with chilled strings is that since they claim to be frozen, code using the pattern:
Is now producing read only
StringIO
instances. It would be preferable to emit a warning instead.We can detect whether the current Ruby produce chilled strings and if so preemptively attempt to mutate the given string to produce the warning immediately and preserve the original behavior.
cc @nobu