From: Yossef Mendelssohn Date: 2008-08-15T07:07:05+09:00 Subject: Re: ruby wish-list On Aug 14, 2:35 pm, Roger Pack wrote: > Rubbing the lamp.... > I wish... > > a = [1,2,3,4] > > a[0..1, 4] > > or > > a[1,2,3] > > worked. Two things: 1) In my mind, this general thread is somewhat ridiculous. It's been going on for -- what is it? -- ten months now? It seems to be just a laundry list for things you want Ruby to do, whether they're sensible or not, without a lot of thought into them, and at least sometimes with reasoning like "I'm lazy and don't want to type some brackets". 2) "I wish X worked" is not a very useful way to describe what should happen. I'm not saying you have to write tests or specs, but do describe the behavior you expect. Maybe looking at the RubySpec project will give you an idea of everything Ruby presently "should do" and what the other implementations are working towards. If that doesn't get you going, think about it as contributing to Rubinius in some way, and the sooner that comes out the sooner you can easily twist even more of Ruby to your desires. When you're working on describing the behavior, consider this (from an irb session in Ruby 1.8.6): >> arr = (1..10).to_a => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] >> arr[3,4] => [4, 5, 6, 7] You seem to want arr[3,4] to return [4,5], and guess what? There's a way to do that now: >> arr.values_at(3,4) => [4, 5] Let's say you don't care for Array#values_at and Array#[] is changed to work as you expect. What will happen when someone who expects the old behavior tries to use it? -- -yossef