From: "Earlopain (Earlopain _) via ruby-core" Date: 2026-07-22T09:39:11+00:00 Subject: [ruby-core:126136] [Ruby Feature#22205] Add deprecation warnings for ruby2_keywords Issue #22205 has been updated by Earlopain (Earlopain _). ruby2_keywords still sees quite a bit of usage in the ecosystem. I think many can easily be migrated now that ruby 3.0 is long EOL already and gems have their `required_ruby_version` set higher (like https://github.com/rails/bootsnap/pull/559). Some use it for performance I believe (and to not break their API contract) but I'm not sure how true that is anymore these days. ```rb ruby2_keywords def ruby2(*args) args end def ruby3(*args, **kwargs) [*args, kwargs] end ``` Often happens when serializing to other places like a database etc. ---------------------------------------- Feature #22205: Add deprecation warnings for ruby2_keywords https://bugs.ruby-lang.org/issues/22205#change-118148 * Author: shugo (Shugo Maeda) * Status: Open ---------------------------------------- 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. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/