From: "duckinator (Nick Markwell)" Date: 2012-07-13T14:22:01+09:00 Subject: [ruby-core:46380] [ruby-trunk - Feature #6727] Add Array#rest (with implementation) Issue #6727 has been updated by duckinator (Nick Markwell). > rest = arr.drop(1) > _, *rest = arr Those two methods you mentioned "work," but the first isn't very clear on its intent, and the second cannot be used as a statement (which is where I have personally seen [1..-1] used the most). > See also http://bugs.ruby-lang.org/projects/ruby/wiki/HowToRequestFeatures 1. Insure it's a meaningful improvement * Yes, this improvement is discussed in multiple Google search results and has received positive feedback when I mentioned it elsewhere. * There are already ways to achieve similar results, but they don't convey their purpose well. * I have seen, and used arr[1..-1] countless times. Also see above statement regarding positive feedback. 2. Think about it * What's a good name? Array#rest * What exact arguments does it accept? None. * What does it return? A new Array. * Any risk of incompatibility? No. 3. Write it up * The title was apparently good, as it was not ignored. * The current situation is improved because Array#rest is clear about your intent, * I made a concise but complete proposal. * I did not address the objection of .drop(1), because I had forgotten about it. I do hope `_, *rest = arr` was purely for demonstrative purposes. 4. Feature request already opened, with patch. Is there any reason for this being rejected besides the existence of (({arr.drop(1)})) and your other method which (in my opinion) should not be necessary unless you're doing (({first, *rest = arr}))? ---------------------------------------- Feature #6727: Add Array#rest (with implementation) https://bugs.ruby-lang.org/issues/6727#change-27996 Author: duckinator (Nick Markwell) Status: Rejected Priority: Normal Assignee: Category: Target version: =begin I run into many instances where I end up using (({arr[1..-1]})), so I decided to add (({arr.rest})) to make that a bit less hideous. Branch on github: (()) Patch: (()) Diff: (()) =end -- http://bugs.ruby-lang.org/