parts.rb: Use a mutable string#70
Conversation
Supports --enable-frozen-string-literal.
|
I got curious https://ruby-doc.org/core-2.3.0/String.html#method-i-2B-40 I Think Ruby 2.0 should be gone, but maybe this is the feedback this needs? https://github.com/Lewiscowles1986/multipart-post/runs/3305811062?check_suite_focus=true This library in Travis, was supporting (5 months ago build); Some quite old versions of Ruby. I saw someone make an interesting commit elsewhere which was to have Ruby 2.5 do something with frozen string literals. I Do not understand this in a robust way. Does this help? |
|
I think I slightly prefer |
|
Anything older than Ruby 2.3 we definitely don't care about. Anything older than Ruby 2.6 I'm okay with dropping if it's inconvenient. |
|
I got 2.5-3.0 working with some playing around on a less tired brain |
|
@olleolleolle will very likely have improvements to my takes on their code.
Now I have green and I understand this better, the only thing I'm a little upset about is that the library requires downstream consumers to Might there be patterns where we can receive the string, and only mutate within this library; so that read is safe. Otherwise it feels like |
|
@Lewiscowles1986 👋 Hi! The --enable-frozen-string-literal is a sort of "nod to the future" where Ruby strings may become immutable. https://freelancing-gods.com/2017/07/27/an-introduction-to-frozen-string-literals.html is a nice blog post where Pat, an activist for "frozen string literals" to happen, describes the feature a little. Nice to see you again, and I hope you had some fun! |
Description
Use an explicitly mutable string, to support
RUBYOPT=--enable-frozen-string-literalI ran into it when trying to get support for that in octokit.rb, and into github-changelog-generator.
https://github.com/octokit/octokit.rb/pull/1354/checks?check_run_id=3298433252
Types of Changes
Testing
Would it be OK to add the RUBYOPT setting mentioned above to CI? Oh, we don't have a running CI, I logged #71.