From: Pedro Fortuny Ayuso Date: 2006-12-17T18:21:36+09:00 Subject: Re: Just some Ruby language ideas, comments wanted. ------=_Part_109_292289.1166347292444 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline (...) > A form of all the classes with Enumerable mixed in (hash, array, etc) > where all the methods like select return not the values that were > selected but an object that contains a reference back to the index of > the array where it was stored. > This would allow things like: > ary = [4, nil, 6, nil] > ary.select{|x| x.nil?}[1].set(2) > ary # => [4, nil, 6, 2] > As it is now, the above wouldn't work because select returns an array of > values from the array, so calling set only changes the value in the > array that was created by set. Wow, I was *just about* going to suggest the very same thing, using the indices instead of the values is necessary quite frequently (at least I find it is so). The name of the method ought to be a bit informative: indices_with indices_such indices_having select_indices I think. I really think this is useful enough to be included in the language. Thanks for the suggestion and eager to help if necessary, Pedro -- Pedro Fortuny Ayuso C/Capuchinos 14, 1. 47006 Valladolid. SPAIN http://pfortuny.sdf-eu.org ------=_Part_109_292289.1166347292444--