ruby-changes:43751
From: nobu <ko1@a...>
Date: Sun, 7 Aug 2016 18:08:38 +0900 (JST)
Subject: [ruby-changes:43751] nobu:r55824 (trunk): deprecate TRUE,FALSE,NIL
nobu 2016-08-07 18:08:29 +0900 (Sun, 07 Aug 2016) New Revision: 55824 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55824 Log: deprecate TRUE,FALSE,NIL * object.c (InitVM_Object): deprecate toplevel constants TRUE, FALSE, and NIL. [Feature #12574] Modified files: trunk/ChangeLog trunk/basictest/test.rb trunk/object.c trunk/test/ruby/test_eval.rb Index: object.c =================================================================== --- object.c (revision 55823) +++ object.c (revision 55824) @@ -3613,6 +3613,14 @@ InitVM_Object(void) https://github.com/ruby/ruby/blob/trunk/object.c#L3613 * An alias of +false+ */ rb_define_global_const("FALSE", Qfalse); + + { + VALUE names[3]; + names[0] = ID2SYM(rb_intern_const("TRUE")); + names[1] = ID2SYM(rb_intern_const("FALSE")); + names[2] = ID2SYM(rb_intern_const("NIL")); + rb_mod_deprecate_constant(3, names, rb_cObject); + } } void Index: test/ruby/test_eval.rb =================================================================== --- test/ruby/test_eval.rb (revision 55823) +++ test/ruby/test_eval.rb (revision 55824) @@ -271,11 +271,9 @@ class TestEval < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_eval.rb#L271 eval 'while false; bad = true; print "foo\n" end' assert(!bad) - assert(eval('TRUE')) + assert(eval('Object')) assert(eval('true')) - assert(!eval('NIL')) assert(!eval('nil')) - assert(!eval('FALSE')) assert(!eval('false')) $foo = 'assert(true)' Index: basictest/test.rb =================================================================== --- basictest/test.rb (revision 55823) +++ basictest/test.rb (revision 55824) @@ -1860,11 +1860,9 @@ $bad=false https://github.com/ruby/ruby/blob/trunk/basictest/test.rb#L1860 eval 'while false; $bad = true; print "foo\n" end' test_ok(!$bad) -test_ok(eval('TRUE')) +test_ok(eval('Object')) test_ok(eval('true')) -test_ok(!eval('NIL')) test_ok(!eval('nil')) -test_ok(!eval('FALSE')) test_ok(!eval('false')) $foo = 'test_ok(true)' Property changes on: basictest/test.rb ___________________________________________________________________ Added: svn:executable + * Index: ChangeLog =================================================================== --- ChangeLog (revision 55823) +++ ChangeLog (revision 55824) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sun Aug 7 18:08:27 2016 Nobuyoshi Nakada <nobu@r...> + + * object.c (InitVM_Object): deprecate toplevel constants TRUE, + FALSE, and NIL. [Feature #12574] + Sun Aug 7 06:48:21 2016 Eric Wong <e@8...> * ext/openssl/ossl_ssl.c (ossl_ssl_write_internal): -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/