From: mame@... Date: 2019-12-26T02:43:04+00:00 Subject: [ruby-core:96482] [Ruby master Feature#16377] Regexp literals should be frozen Issue #16377 has been updated by mame (Yusuke Endoh). Assignee set to mame (Yusuke Endoh) At the previous dev meeting, matz said that let's give it a try :-) For the record: `Regexp.new` should continue to return unfrozen Regexp instance. I'll review the pull request. ---------------------------------------- Feature #16377: Regexp literals should be frozen https://bugs.ruby-lang.org/issues/16377#change-83411 * Author: byroot (Jean Boussier) * Status: Open * Priority: Normal * Assignee: mame (Yusuke Endoh) * Target version: 2.8 ---------------------------------------- The following script: ```ruby def mutate re = /foo/ state = re.instance_variable_get(:@state) re.instance_variable_set(:@state, state.to_i + 1) state end 3.times do p mutate end ``` Output this: ``` nil 1 2 ``` IMHO, you shouldn't be able to mutate an unduplicated literal. GitHub pull request: https://github.com/ruby/ruby/pull/2705 -- https://bugs.ruby-lang.org/ Unsubscribe: