Skip to content
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

Explicitly define mutable strings #620

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

HashNotAdam
Copy link

@HashNotAdam HashNotAdam commented Dec 27, 2024

Summary

Use String.new to explicitly define strings that will be mutable

Other Information

Ruby 2.3 introduced a magic comment, frozen_string_literal: true, that allows strings to be immutable by default. Ruby 3.4 is preparing to make this the default behavior and throws deprecation warnings when mutating strings.

There are many ways to make a mutable string, but I've chosen to use String.new because it is the most explicit option and also doesn't require creating multiple string objects

Deprecation warnings are still being thrown by rubyzip. While they have a fix in main, there is no new release and I didn't think it would be appropriate for me to move the dependency to GitHub

Ruby 2.3 introduced a magic comment, `frozen_string_literal: true`, that
allows strings to be immutable by default. Ruby 3.4 is preparing to make
this the default behavior and throws deprecation warnings when mutating
strings.

There are many ways to make a mutable string, but I've chosen to use
`String.new` because it is the most explicit option and also doesn't
require creating multiple string objects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant