On 2017/08/11 01:12, david.n.arnold / gmail.com wrote: > Also, as a side note, it seems that Hash#select and #reject really are the only two methods that behave this way. And even inside Hash, methods like #collect, #collect_concat, #drop, #drop_while, #grep, #max, #max_by, #min, #min_by, #sort, #sort_by, #take, and #take_while are all still returning Array. Let's analyze this a bit. #max, #max_by, #min, #min_by These return a single key, value pair as an array. That's much easier to handle than a hash with a single key, value pair, and is also quite a bit more efficient internally (although we shouldn't care). That feels right to me. #grep In the case of a hash, the argument to #grep has to be a two-element array ([key, value]). Because there is only one entry with a given key in the hash, the result will also be a single two-element array, #collect, #collect_concat The block for collect can return anything. Putting these 'anythings' together again can only be done with an array, not with a hash. As an example, think about something like: h.collect {|k, v| "#{k}-#{v}"} We get back strings, and there is no such thing as a Hash of Strings. #sort, #sort_by Although Hashes now have order, that wasn't always the case. And Hashes are still not considered the prime class when dealing with order. As an example, they don't allow easy access to an element at a certain position in the order. #drop, #drop_while, #take, #take_while Similar considerations to those for #sort apply here, although maybe not that strongly. > ---------------------------------------- > Bug #13795: Hash#select return type does not match Hash#find_all > https://bugs.ruby-lang.org/issues/13795#change-66129 > > * Author: davidarnold (David Arnold) > * Status: Open > * Priority: Normal > * Assignee: > * Target version: > * ruby -v: ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16] > * Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN > ---------------------------------------- Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>