From: Dan Schmidt Date: 2001-03-30T06:10:05+09:00 Subject: [ruby-talk:13340] Re: hash slice implementaion Mathieu Bouchard writes: | On Fri, 30 Mar 2001, Dan Schmidt wrote: | > I made the suggestion recently that Array#[] and Hash#[] exhibit | > slicing behavior when the argument is an Array (or any Enumerable, | > maybe? Array#[](aRange) already works like this). | | If you accept any Enumerable, you have to make an exception for Range, | because Array#[] and Array#[]= bypass Range's builtin semantics | completely in their support for negative indices. Mm, and I don't think that you want to automatically get this behavior for just anything you happen to be able to enumerate. | > It would mean that you couldn't use Arrays as keys to Hashes, but | > that seems like a bad idea anyway. | | You think so? Yes, I do, as I said. But I wouldn't mind being proved wrong. -- http://www.dfan.org