Freeze Regexp literals - #2705
Conversation
0aae08e to
16471e9
Compare
|
This makes sense to me. Instructions are clearly using a This is technically not backwards compatible, so I think we may need to discuss more (at least get a 👍 from matz). Can you open a ticket in Redmine? |
|
This ticket already exists. https://bugs.ruby-lang.org/issues/8948 |
I didn't know about it so I created https://bugs.ruby-lang.org/issues/16377 right after this PR.
I'll add it to the developers meeting ticket. |
|
Actually according to https://bugs.ruby-lang.org/issues/8948#note-14 Matz already agreed to freeze regexp literals. The discussion was still ongoing because some wanted to freeze all regexps. Not sure if we can rely on a 2 years old 👍 from Matz though. |
|
Could you rebase the pull request onto master? After that, I'll merge this. |
ecb7202 to
57fc058
Compare
|
@mame done! |
[Feature ruby#8948] [Feature ruby#16377] Since Regexp literals always reference the same instance, allowing to mutate them can lead to state leak.
57fc058 to
c43f99f
Compare
|
Another conflict happened, so I rebased again. |
|
Sorry for my late action. Thank you for your contribution! |
|
No worries, thanks for merging. |
Since Regexp literals always reference the same instance,
allowing to mutate them can lead to state leak.
The following script:
Output this on 2.6:
IMHO, you shouldn't be able to mutate an unduplicated literal.
cc @methodmissing