Skip to content

Commit 62554ca

Browse files
committed
Removed NIL/TRUE/FALSE
Deprerecated constants which had been warned since 2.4.
1 parent 3152977 commit 62554ca

File tree

2 files changed

+0
-39
lines changed

2 files changed

+0
-39
lines changed

object.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4692,11 +4692,6 @@ InitVM_Object(void)
46924692
rb_define_method(rb_cNilClass, "nil?", rb_true, 0);
46934693
rb_undef_alloc_func(rb_cNilClass);
46944694
rb_undef_method(CLASS_OF(rb_cNilClass), "new");
4695-
/*
4696-
* An obsolete alias of +nil+
4697-
*/
4698-
rb_define_global_const("NIL", Qnil);
4699-
rb_deprecate_constant(rb_cObject, "NIL");
47004695

47014696
rb_define_method(rb_cModule, "freeze", rb_mod_freeze, 0);
47024697
rb_define_method(rb_cModule, "===", rb_mod_eqq, 1);
@@ -4781,11 +4776,6 @@ InitVM_Object(void)
47814776
rb_define_method(rb_cTrueClass, "===", rb_equal, 1);
47824777
rb_undef_alloc_func(rb_cTrueClass);
47834778
rb_undef_method(CLASS_OF(rb_cTrueClass), "new");
4784-
/*
4785-
* An obsolete alias of +true+
4786-
*/
4787-
rb_define_global_const("TRUE", Qtrue);
4788-
rb_deprecate_constant(rb_cObject, "TRUE");
47894779

47904780
rb_cFalseClass = rb_define_class("FalseClass", rb_cObject);
47914781
rb_cFalseClass_to_s = rb_fstring_enc_lit("false", rb_usascii_encoding());
@@ -4798,11 +4788,6 @@ InitVM_Object(void)
47984788
rb_define_method(rb_cFalseClass, "===", rb_equal, 1);
47994789
rb_undef_alloc_func(rb_cFalseClass);
48004790
rb_undef_method(CLASS_OF(rb_cFalseClass), "new");
4801-
/*
4802-
* An obsolete alias of +false+
4803-
*/
4804-
rb_define_global_const("FALSE", Qfalse);
4805-
rb_deprecate_constant(rb_cObject, "FALSE");
48064791
}
48074792

48084793
#include "kernel.rbinc"

spec/ruby/language/predefined_spec.rb

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,8 +1091,6 @@ def obj.foo2; yield; end
10911091
DATA IO If the main program file contains the directive __END__, then
10921092
the constant DATA will be initialized so that reading from it will
10931093
return lines following __END__ from the source file.
1094-
FALSE FalseClass Synonym for false.
1095-
NIL NilClass Synonym for nil.
10961094
RUBY_PLATFORM String The identifier of the platform running this program. This string
10971095
is in the same form as the platform identifier used by the GNU
10981096
configure utility (which is not a coincidence).
@@ -1110,31 +1108,9 @@ def obj.foo2; yield; end
11101108
the value.
11111109
TOPLEVEL_BINDING Binding A Binding object representing the binding at Ruby’s top level—
11121110
the level where programs are initially executed.
1113-
TRUE TrueClass Synonym for true.
11141111
=end
11151112

11161113
describe "The predefined global constants" do
1117-
it "includes TRUE" do
1118-
Object.const_defined?(:TRUE).should == true
1119-
-> {
1120-
TRUE.should equal(true)
1121-
}.should complain(/constant ::TRUE is deprecated/)
1122-
end
1123-
1124-
it "includes FALSE" do
1125-
Object.const_defined?(:FALSE).should == true
1126-
-> {
1127-
FALSE.should equal(false)
1128-
}.should complain(/constant ::FALSE is deprecated/)
1129-
end
1130-
1131-
it "includes NIL" do
1132-
Object.const_defined?(:NIL).should == true
1133-
-> {
1134-
NIL.should equal(nil)
1135-
}.should complain(/constant ::NIL is deprecated/)
1136-
end
1137-
11381114
it "includes STDIN" do
11391115
Object.const_defined?(:STDIN).should == true
11401116
end

0 commit comments

Comments
 (0)