ruby-changes:9247
From: knu <ko1@a...>
Date: Tue, 16 Dec 2008 17:15:39 +0900 (JST)
Subject: [ruby-changes:9247] Ruby:r20783 (ruby_1_8): * array.c (rb_ary_nitems, rb_ary_choice): Add a deprecation
knu 2008-12-16 17:15:21 +0900 (Tue, 16 Dec 2008) New Revision: 20783 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=20783 Log: * array.c (rb_ary_nitems, rb_ary_choice): Add a deprecation warning. * hash.c (env_index, rb_hash_index): Simplify the deprecation warnings. Modified files: branches/ruby_1_8/ChangeLog branches/ruby_1_8/array.c branches/ruby_1_8/hash.c Index: ruby_1_8/array.c =================================================================== --- ruby_1_8/array.c (revision 20782) +++ ruby_1_8/array.c (revision 20783) @@ -3067,6 +3067,8 @@ long n = 0; VALUE *p, *pend; + rb_warn("Array#nitems is deprecated; use Array#count { |i| !i.nil? }"); + for (p = RARRAY(ary)->ptr, pend = p + RARRAY(ary)->len; p < pend; p++) { if (!NIL_P(*p)) n++; } @@ -3363,6 +3365,8 @@ { long i, j; + rb_warn("Array#choice is deprecated; use Array#sample"); + i = RARRAY(ary)->len; if (i == 0) return Qnil; j = rb_genrand_real()*i; Index: ruby_1_8/hash.c =================================================================== --- ruby_1_8/hash.c (revision 20782) +++ ruby_1_8/hash.c (revision 20783) @@ -705,7 +705,7 @@ rb_hash_index(hash, value) VALUE hash, value; { - rb_warning("Hash#index is deprecated and will be removed in 1.9; use Hash#key"); + rb_warning("Hash#index is deprecated; use Hash#key"); return rb_hash_key(hash, value); } @@ -2484,7 +2484,7 @@ env_index(dmy, value) VALUE dmy, value; { - rb_warning("ENV.index is deprecated and will be removed in 1.9; use ENV.key"); + rb_warning("ENV.index is deprecated; use ENV.key"); return env_key(dmy, value); } Index: ruby_1_8/ChangeLog =================================================================== --- ruby_1_8/ChangeLog (revision 20782) +++ ruby_1_8/ChangeLog (revision 20783) @@ -1,3 +1,11 @@ +Tue Dec 16 17:14:01 2008 Akinori MUSHA <knu@i...> + + * array.c (rb_ary_nitems, rb_ary_choice): Add a deprecation + warning. + + * hash.c (env_index, rb_hash_index): Simplify the deprecation + warnings. + Mon Dec 15 18:53:17 2008 Yukihiro Matsumoto <matz@r...> * lib/sync.rb (Sync_m#sync_try_lock): wrong variable name fixed. -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/