From: "Eregon (Benoit Daloze) via ruby-core" Date: 2026-07-25T20:48:44+00:00 Subject: [ruby-core:126170] [Ruby Feature#22205] Deprecate ruby2_keywords Issue #22205 has been updated by Eregon (Benoit Daloze). Big +1 from me, and agreed it's definitely worth deprecating them but also there is no immediate need so the proposed schedule sounds good to me. The main thing I'm interested to remove is the special dispatch on `foo(*args)` when `args.last` is a `ruby2_keywords`-marked Hash. For that we need all these methods to be removed (or become noop, so 4.4 in the current proposed schedule). My only question would be whether aligning both schedules for the methods might make sense, so it's more "consistent/simpler" for users. shugo (Shugo Maeda) wrote in #note-8: > they are needed to deal with flagged hashes during the migration period? Could you give an example? I'm not sure to follow. ---------------------------------------- Feature #22205: Deprecate ruby2_keywords https://bugs.ruby-lang.org/issues/22205#change-118240 * 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. ## Schedule ### For Module#ruby2_keywords, main.ruby2_keywords, and Proc#ruby2_keywords * 4.1: Documentation-only deprecation * 4.2: Verbose-mode deprecation warning * 4.3: Non-verbose-mode deprecation warning * 4.4: Removal ### For Hash.ruby2_keywords_hash?, Hash.ruby2_keywords_hash * 4.1: Documentation-only deprecation * 4.2: No warnings, still working as migration tools * 4.3: Verbose-mode deprecation warning * 4.4: Non-verbose-mode deprecation warning. Hash.ruby2_keywords_hash? always returns false, and Hash.ruby2_keywords_hash returns a plain duplicate of the given hash * 4.5: Removal -- 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/