Skip to content

Interpolated strings are no longer frozen with frozen-string-literal: true - #3488

Merged
eregon merged 1 commit into
ruby:masterfrom
eregon:unfrozen-interpolated-strings
Sep 15, 2020
Merged

Interpolated strings are no longer frozen with frozen-string-literal: true#3488
eregon merged 1 commit into
ruby:masterfrom
eregon:unfrozen-interpolated-strings

Conversation

@eregon

@eregon eregon commented Aug 31, 2020

Copy link
Copy Markdown
Member
  • Remove freezestring instruction since this was the only usage for it.
  • [Feature #17104]

@eregon
eregon requested review from akr, jeremyevans and ko1 August 31, 2020 20:05
Comment thread test/ruby/test_iseq.rb
assert_predicate(s3, :frozen?)
assert_predicate(s4, :frozen?)
assert_not_predicate(s3, :frozen?)
assert_predicate(s4, :frozen?) # should probably not be frozen, but unrealistic code

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find what optimizes s = "#{'foo'}" to just putobject "foo".
Ideally it should not be frozen.
OTOH, I believe nobody write such code (but rather "#{s}").

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eregon
eregon force-pushed the unfrozen-interpolated-strings branch from 24042ed to 7666cbe Compare August 31, 2020 20:11

@jeremyevans jeremyevans left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, but @ko1 should probably review the compile.c parts as my experience there is more limited.

… true

* Remove freezestring instruction since this was the only usage for it.
* [Feature ruby#17104]
@eregon
eregon force-pushed the unfrozen-interpolated-strings branch from 7666cbe to 24bf9ed Compare September 15, 2020 19:29
@eregon

eregon commented Sep 15, 2020

Copy link
Copy Markdown
Member Author

I was waiting for more reviews but they did not happen in 2 weeks.
I'll merge this so it's in time for preview1.
The semantics change has been accepted by matz on the issue.

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.

2 participants