From: TRANS Date: 2005-05-11T02:30:26+09:00 Subject: Re: [BUG?] Array#slice!() adds elements to Array Thanks Florian. I'll look it over. I'm just getting back to work now. Spent the last week or so moving. T. On 5/5/05, Florian Gro� wrote: > Moin. > > The following behavior is undocumented and IMHO counter-intuitive and of > little use: > > # Limit an array to three elements > irb(main):001:0> obj = [1]; obj.slice!(3 .. -1); obj > => [1, nil, nil] > > I've always thought about .slice!() as a good way of truncating. The > above conflicts with that use of the method. > > Note that I am okay with having that behavior for obj[3 .. -1] = [] so > it would still be reachable in case anybody finds it useful. If that is > too long I think it would also be okay to add Array#size= for that case. > > If you think that the above makes sense the documentation should still > be updated to point out that case and I think it would be a good idea to > add a method for truncating arrays in that case. > > Kind regards, > Florian Gross > >