From: "Eregon (Benoit Daloze)" Date: 2012-10-28T20:25:43+09:00 Subject: [ruby-core:48515] [ruby-trunk - Feature #6727] Add Array#rest (with implementation) Issue #6727 has been updated by Eregon (Benoit Daloze). duckinator (Nick Markwell) wrote: > Regarding examples of it used in practice: > > Just from code I happened to already have on my system, there is 501 instances of [1..-1] in Ruby code. > > https://gist.github.com/3967189 Thank you for searching for examples! I guess you are aware many of these examples are using String#[1..-1]. A few examples are using MatchData#[1..-1], which should be replaced by MathData#captures. For Bundler, only 1 example is Array#[], the 3 others are String#[]. For Cinch, 2 of 4 are Array#[] (1 MatchData#[] and 1 String#[]). Oddly enough, 2 out of these 3 examples of Array#[] are actually removing the first line of an Exception backtrace. For my part, I don't feel a real need for Array#rest, and I dislike #rest because it would imply the structure has an head and a tail, which Array does not. I think having a long/not-so-good-looking way to take all elements but the first is an advantage as it does not encourage this operation which is rarely optimal. As I said earlier, I think Array#drop is nicely used in this case. ---------------------------------------- Feature #6727: Add Array#rest (with implementation) https://bugs.ruby-lang.org/issues/6727#change-31863 Author: duckinator (Nick Markwell) Status: Assigned Priority: Normal Assignee: matz (Yukihiro Matsumoto) Category: core Target version: next minor =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/