From: "matz (Yukihiro Matsumoto) via ruby-core" Date: 2025-07-10T08:45:25+00:00 Subject: [ruby-core:122710] [Ruby Feature#21455] Add a block argument to Array#join Issue #21455 has been updated by matz (Yukihiro Matsumoto). Status changed from Open to Rejected It's fundamentally `join_map` we have rejected. Array#join should join, not mapping. We are not going to add every enumerable method combined with map. `filter_map` is an exception. Matz. ---------------------------------------- Feature #21455: Add a block argument to Array#join https://bugs.ruby-lang.org/issues/21455#change-113987 * Author: leoarnold (Leo Arnold) * Status: Rejected ---------------------------------------- I sometimes come across code like this where the `Array#join` at the end can easily be overlooked or stands out like a sore thumb: ```ruby hex_string = string.bytes.map do |byte| format('%02X', byte) end.join(' ') ``` It seems idiomatic and more succinct to pass the block to `Array#join` directly: ```ruby hex_string = string.bytes.join(' ') do |byte| format('%02X', byte) end ``` Pull Request: https://github.com/ruby/ruby/pull/13731 -- 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/