summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-27 11:37:51 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-27 11:37:51 +0000
commit2321ea3d7baead27cc376ae8788124d1981dcb6e (patch)
tree681e0f606937ddc01fae4ad80b62e0041db672c5
parentc8b99039e6c368d78a85c3c056e5e5dfd00285b6 (diff)
Add a note about Array#slice! changes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--NEWS31
1 files changed, 31 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 63b8ab26b3..60eda7a813 100644
--- a/NEWS
+++ b/NEWS
@@ -395,6 +395,37 @@ with all sufficient information, see the ChangeLog file.
=== 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.