Project

General

Profile

Actions

Feature #8458

closed

Array#merge/merge!

Feature #8458: Array#merge/merge!

Added by Anonymous over 12 years ago. Updated over 12 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-core:55186]

Description

Very simple method can be defined:

class Array
def merge! other
require 'active_support/all' # can't use #tap, see #8457
tail = extract_options!
other_tail = other.extract_options!
concat( other ) << tail.update( other_tail )
end
end

When pondering about where this method should dwell, it seemed to me, perhaps in the core itself? Am I deluding myself?

Updated by matz (Yukihiro Matsumoto) over 12 years ago Actions #1 [ruby-core:55189]

  • Status changed from Open to Rejected

Generally speaking, arrays are not argument lists. This method is specific to argument lists.
Thus Array is not the right place for the method.

Matz.

Updated by Anonymous over 12 years ago Actions #2 [ruby-core:55201]

Still, many thanks for [:A, :B, C: 1] syntax, I was very happy to discover it!

matz (Yukihiro Matsumoto) wrote:

Generally speaking, arrays are not argument lists. This method is specific to argument lists.
Thus Array is not the right place for the method.

Matz.

Actions

Also available in: PDF Atom