Project

General

Profile

Feature #22205

Updated by shugo (Shugo Maeda) 2 months ago

# Add deprecation warnings for ruby2_keywords 

 I believe ruby2_keywords should be removed in the future, but removing it now would cause compatibility issues. As a first step, how about adding deprecation warnings to ruby2_keywords? 

 At least the following methods should emit a warning: 

 * Module#ruby2_keywords 
 * main.ruby2_keywords 
 * Proc#ruby2_keywords 

 The following methods are relatively harmless, so it might be better not to warn on them in the first step: 

 * Hash.ruby2_keywords_hash? 
 * Hash.ruby2_keywords_hash 

 ## Background and Motivation 

 While implementing Proc#refined, I noticed that the ruby2_keywords flag on an iseq (param.flags.ruby2_keywords) can be mutated by Proc#ruby2_keywords even when the iseq is shared among multiple Ractors, which is not Ractor-safe. 

 I consider ruby2_keywords a negative legacy, and I would rather deprecate it than fix such behavior. 

Back