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

Don't freeze input strings #28729

Merged
merged 1 commit into from Apr 11, 2017
Merged

Don't freeze input strings #28729

merged 1 commit into from Apr 11, 2017

Conversation

@matthewd
Copy link
Member

@matthewd matthewd commented Apr 11, 2017

See 34321e4 for background on ImmutableString vs String.

Our String type cannot delegate typecasting to ImmutableString, because the latter freezes its input: duplicating the value after that gives us an unfrozen result, but still mutates the originally passed object.

Fixes #24185
Fixes #28718

See 34321e4 for background on
ImmutableString vs String.

Our String type cannot delegate typecasting to ImmutableString, because
the latter freezes its input: duplicating the value after that gives us
an unfrozen result, but still mutates the originally passed object.
::String.new(super)
case value
when ::String then ::String.new(value)
when true then "t".freeze

This comment has been minimized.

@rafaelfranca

rafaelfranca Apr 11, 2017
Member

It just sucks that we have to duplicate the conditionals and the true and false cases.

This comment has been minimized.

@kaspth

kaspth Apr 11, 2017
Member

True, but it seems the rate of change on these branches is fairly low.

@matthewd matthewd merged commit fff414e into rails:master Apr 11, 2017
2 checks passed
2 checks passed
codeclimate no new or fixed issues
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
matthewd added a commit that referenced this pull request Apr 11, 2017
Don't freeze input strings
matthewd added a commit that referenced this pull request Apr 11, 2017
Don't freeze input strings
@matthewd
Copy link
Member Author

@matthewd matthewd commented Apr 11, 2017

@matthewd matthewd deleted the matthewd:dont-freeze-inputs branch Jun 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.