ruby-changes:5152
From: knu <ko1@a...>
Date: Tue, 27 May 2008 20:38:31 +0900 (JST)
Subject: [ruby-changes:5152] Ruby:r16647 (ruby_1_8_7): Merge from ruby_1_8.
knu 2008-05-27 20:38:17 +0900 (Tue, 27 May 2008)
New Revision: 16647
Modified files:
branches/ruby_1_8_7/NEWS
Log:
Merge from ruby_1_8.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8_7/NEWS?r1=16647&r2=16646&diff_format=u
Index: ruby_1_8_7/NEWS
===================================================================
--- ruby_1_8_7/NEWS (revision 16646)
+++ ruby_1_8_7/NEWS (revision 16647)
@@ -395,6 +395,37 @@
=== Compatibility issues (excluding feature bug fixes)
+* String#slice! had some unintentional bugs and they have been fixed
+ because either they disagreed with documentation or their respective
+ behavior of #slice. Unfortunately, this causes some
+ incompatibilities in the following (somewhat rare) cases.
+
+ * #slice! no longer expands the array when an out-of-boundary value
+ is given.
+
+ # Ruby 1.8.6
+ a = [1,2]
+ a.slice!(4,0) #=> nil
+ a #=> [1,2,nil,nil]
+
+ # Ruby 1.8.7
+ a = [1,2]
+ a.slice!(4,0) #=> nil
+ a #=> [1,2]
+
+ * #slice! no longer raises an exception but returns nil when a
+ negative length or out-of-boundary negative position is given.
+
+ # Ruby 1.8.6
+ a = [1,2]
+ a.slice!(1,-1) #=> (raises IndexError)
+ a.slice!(-5,1) #=> (raises IndexError)
+
+ # Ruby 1.8.7
+ a = [1,2]
+ a.slice!(1,-1) #=> nil
+ a.slice!(-5,1) #=> nil
+
* String#to_i, String#hex and String#oct no longer accept a sequence
of underscores (`__') as part of a number.
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/