From: Antonio Cangiano Date: 2009-05-29T03:31:05+09:00 Subject: Re: Strange ruby-1.9.1 array substitution answer --001485f44fb469d1b8046afd2965 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On Thu, May 28, 2009 at 2:06 PM, Michel Demazure wrote: > Strange ! > > arr = [1,2,3,4,5] > arr[0,2] = nil > => ruby 1.8 : arr = [3,4,5] > => ruby 1.9 : arr = [nil, 3,4,5] > > ruby -v > ruby 1.9.1 (2008-10-28 revision 19983) [i386-mswin32] It's a bug. They either fixed it in a more recent version or it's a Windows specific issue. On my Mac it works as expected: $ ruby1.9 -v ruby 1.9.1p0 (2009-01-30 revision 21907) [i386-darwin9] $ irb >> arr = [1,2,3,4,5] => [1, 2, 3, 4, 5] >> arr[0,2] = nil => nil >> arr => [3, 4, 5] Cheers, Antonio -- My startup: http://ThinkCode.TV Zen and the Art of Programming: http://AntonioCangiano.com Aperiodico di resistenza informatica: http://StackTrace.it Author of "Ruby on Rails for Microsoft Developers": http://bit.ly/rorforms --001485f44fb469d1b8046afd2965--