From: Ibraheem Umaru-Mohammed Date: 2004-12-10T07:51:51+09:00 Subject: Re: String#split behaves odd [Array#delete confusion] +++ Gavin Sinclair [ruby-talk] [10/12/04 06:43 +0900]: [...] > Array#compact > > It doesn't currently take a parameter, so allow it to take one. FWIW > I think Array#delete should be deprecated, and Array#compact extended > in this fashion. I don't see a good rationale for the return value of > Array#delete, and when a method is called #delete there is always > confusion about whether it's destructive. > > Ruby spoils us so much that when you have to look something up in the > docs a few times you feel cheated :) > [...] I agree. Something doesn't seem right with Array#delete. When I first encountered it, I expected only the first object to be removed, not _all_ of them. And because the deletion was greedy, I thought they'd be an easy way to specify just how many of those objects you wanted removed. There didn't seem to be, so I submitted RCR285, along with some suggestions for Array#delete_at. I also expected Array#delete to give back a new array with the deleted objects removed, as my instincts led me to believe there'd be an Array#delete!. But again, no. I don't however, agree that Array#delete should be deprecated, simply because I believe a new ruby programmer is more likely to expect a 'delete' rather than a 'compact' to do what they want to do. Although that's probably not reason enough, I suspect they'd check for 'remove' or 'delete' before they came across 'compact' --ibz. --