Issue #12333 has been updated by Satoru Horie.

File multi_concat_prepend.patch added

I have written a patch.

And, there are some points to ask
* What is the appropriate behavior when calling concat/prepend without argument?
 * The code attached now returns just self
* What should happen when writing ar.concat(ar, ar)?
 * ar = [1]; ar.concat(ar, ar) #=> [1,1,1]? or [1,1,1,1]?
 * ar << ar << ar returns [1,1,1,1], of course because this is just a sequence of binary operations
 * However, I feel "ar.concat(ar, ar)" saying "append present content of the array twice to the array", meaning [1,2,1,2,1,2]
 * The code attached returns [1,1,1,1], for now, just for the simplicity of implementation

----------------------------------------
Feature #12333: `String#concat`, `Array#concat`, `String#prepend` to take multiple arguments
https://bugs.ruby-lang.org/issues/12333#change-58446

* Author: Tsuyoshi Sawada
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
I would like `String#concat`, `Array#concat`, `String#prepend` to take multiple arguments

~~~ruby
s = ""
s.concat("a", "b", "c")
a.prepend("A", "B", "C")
s # => "ABCabc"

a = []
a.concat(["a"], ["b", "c"])
a # => ["a", "b", "c"]
~~~

---Files--------------------------------
multi_concat_prepend.patch (2.94 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>