From: mame@... Date: 2020-01-06T23:27:57+00:00 Subject: [ruby-core:96696] [Ruby master Bug#16486] Hash.ruby2_keywords?(hash) and Hash.ruby2_keywords!(hash) Issue #16486 has been updated by mame (Yusuke Endoh). Assignee set to matz (Yukihiro Matsumoto) Status changed from Open to Assigned @jeremyevans0 @eregon Thanks, I put this on the next dev meeting. ---------------------------------------- Bug #16486: Hash.ruby2_keywords?(hash) and Hash.ruby2_keywords!(hash) https://bugs.ruby-lang.org/issues/16486#change-83681 * Author: mame (Yusuke Endoh) * Status: Assigned * Priority: Normal * Assignee: matz (Yukihiro Matsumoto) * Target version: * ruby -v: * Backport: 2.5: DONTNEED, 2.6: DONTNEED, 2.7: REQUIRED ---------------------------------------- Hash's ruby2_keywords flag is designed to be as implicit as possible, but unfortunately, sometimes we need to handle the flag explicitly. In ActiveJob, the whole arguments are serialized and deserialized, and the process removes the flag; in this case, we need to check and save the flag when serializing, and restore the flag when deserializing. https://github.com/rails/rails/pull/38105#discussion_r361863767 It is theoretically possible by [a very hacky code](https://gist.github.com/mame/18cd2dfc7d965d0bad1216f2fdd008ee#file-bouncing_test-patch-L117-L134), but it would be good to provide them officially. https://github.com/ruby/ruby/pull/2818 * `Hash.ruby2_keywords?(hash)` checks if hash is flagged or not. * `Hash.ruby2_keywords!(hash)` flags a given hash. The reason why I don't add them as instance methods (`Hash#ruby2_keywords?`) is that they are never for casual use. The ruby2_keywords flag will be removed after enough migration time. Casual use of them will make it difficult to remove, so I'd like to keep them for non-casual use. (I thought `RubyVM.ruby2_keywords?(hash)` is good but @eregon will be against it :-) @jeremyevans0 Could you tell me your opinion? -- https://bugs.ruby-lang.org/ Unsubscribe: