Skip to content

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

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

Merged
merged 1 commit into from
Sep 15, 2020

Conversation

eregon
Copy link
Member

@eregon eregon commented Aug 31, 2020

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

@eregon eregon requested review from jeremyevans, ko1 and akr August 31, 2020 20:05
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
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
Member Author

Choose a reason for hiding this comment

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

@nobu has a fix for this: https://bugs.ruby-lang.org/issues/17104#note-20
I'm not sure if it's worth the added complexity.

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

@jeremyevans jeremyevans left a comment

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 #17104]
@eregon eregon force-pushed the unfrozen-interpolated-strings branch from 7666cbe to 24bf9ed Compare September 15, 2020 19:29
@eregon
Copy link
Member Author

eregon commented Sep 15, 2020

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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy