[前][次][番号順一覧][スレッド一覧]

ruby-changes:25871

From: ko1 <ko1@a...>
Date: Wed, 28 Nov 2012 17:01:07 +0900 (JST)
Subject: [ruby-changes:25871] ko1:r37928 (trunk): * proc.c: remove Proc#== and Proc#eql?.

ko1	2012-11-28 17:00:53 +0900 (Wed, 28 Nov 2012)

  New Revision: 37928

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=37928

  Log:
    * proc.c: remove Proc#== and Proc#eql?.
      Proc objects compared with thier object ids.
    * test/ruby/test_proc.rb: remove related test.

  Modified files:
    trunk/ChangeLog
    trunk/proc.c
    trunk/test/ruby/test_proc.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 37927)
+++ ChangeLog	(revision 37928)
@@ -1,3 +1,10 @@
+Wed Nov 28 16:59:12 2012  Koichi Sasada  <ko1@a...>
+
+	* proc.c: remove Proc#== and Proc#eql?.
+	  Proc objects compared with thier object ids.
+
+	* test/ruby/test_proc.rb: remove related test.
+
 Wed Nov 28 16:41:04 2012  Eric Hodel  <drbrain@s...>
 
 	* lib/rdoc/servlet.rb:  Add support for serving documentation from a
Index: proc.c
===================================================================
--- proc.c	(revision 37927)
+++ proc.c	(revision 37928)
@@ -774,37 +774,6 @@
     return rb_iseq_parameters(iseq, is_proc);
 }
 
-/*
- * call-seq:
- *   prc == other_proc   ->  true or false
- *
- * Returns <code>true</code> if <i>prc</i> is the same object as
- * <i>other_proc</i>, or if they are both procs with the same body.
- */
-
-static VALUE
-proc_eq(VALUE self, VALUE other)
-{
-    if (self == other) {
-	return Qtrue;
-    }
-    else {
-	if (rb_obj_is_proc(other)) {
-	    rb_proc_t *p1, *p2;
-	    GetProcPtr(self, p1);
-	    GetProcPtr(other, p2);
-	    if (p1->envval == p2->envval &&
-		p1->block.iseq->iseq_size == p2->block.iseq->iseq_size &&
-		p1->block.iseq->local_size == p2->block.iseq->local_size &&
-		MEMCMP(p1->block.iseq->iseq, p2->block.iseq->iseq, VALUE,
-		       p1->block.iseq->iseq_size) == 0) {
-		return Qtrue;
-	    }
-	}
-    }
-    return Qfalse;
-}
-
 st_index_t
 rb_hash_proc(st_index_t hash, VALUE prc)
 {
@@ -2241,8 +2210,6 @@
     rb_define_method(rb_cProc, "arity", proc_arity, 0);
     rb_define_method(rb_cProc, "clone", proc_clone, 0);
     rb_define_method(rb_cProc, "dup", proc_dup, 0);
-    rb_define_method(rb_cProc, "==", proc_eq, 1);
-    rb_define_method(rb_cProc, "eql?", proc_eq, 1);
     rb_define_method(rb_cProc, "hash", proc_hash, 0);
     rb_define_method(rb_cProc, "to_s", proc_to_s, 0);
     rb_define_alias(rb_cProc, "inspect", "to_s");
Index: test/ruby/test_proc.rb
===================================================================
--- test/ruby/test_proc.rb	(revision 37927)
+++ test/ruby/test_proc.rb	(revision 37928)
@@ -339,12 +339,6 @@
     t.kill
   end
 
-  def test_eq2
-    b1 = proc { }
-    b2 = b1.dup
-    assert(b1 == b2)
-  end
-
   def test_to_proc
     b = proc { :foo }
     assert_equal(:foo, b.to_proc.call)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]