From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-2.9 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_BL_SPAMCOP_NET,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY shortcircuit=no autolearn=no autolearn_force=no version=3.4.2 Received: from nue.mailmanlists.eu (nue.mailmanlists.eu [IPv6:2a01:4f8:1c0c:6b10::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id A552D1F601 for ; Tue, 6 Dec 2022 09:13:16 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.b="dE6TghVU"; dkim-atps=neutral Received: from nue.mailmanlists.eu (localhost [127.0.0.1]) by nue.mailmanlists.eu (Postfix) with ESMTP id 609A07E583; Tue, 6 Dec 2022 09:13:10 +0000 (UTC) Authentication-Results: nue.mailmanlists.eu; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=dE6TghVU; dkim-atps=neutral Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by nue.mailmanlists.eu (Postfix) with ESMTPS id DEA4F7E4E2 for ; Tue, 6 Dec 2022 09:13:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ruby-lang.org; h=from:references:subject:mime-version:content-type: content-transfer-encoding:list-id:to:cc:content-type:from:subject:to; s=s1; bh=IuDHhD+sX8TMgDucb8cUsxhAtogdZdOGMnqmA6wPigY=; b=dE6TghVUy/ZBfwn/lp6NEvNpBN+EJqlCw/BbSmH8ym+5eQUockomzREGl0NREr4wAs1g r2pow7oPrun0jd4FZMJhjcvDveKUVcnaH6LTfFtJmldaMTNtAewf4OFYc/xn8lBiiGraoX VFaUeiS4npBx8bh3Y/W9Qd8X1rjPgTluOD8v7H0kbpOQD4biRM6/byneTFmyHner2JsCUF nV5qFtax07x66ctJNCB0f8tiYqC89ap3OTOZbZ6D5+dUbi+fX+EUx+5Rv61//H5Z9AnYAn KY9XZTmuNcXgCB36Y3FJvVxTsWDpJklaN3kL6vhkWpcPW2RmkQyfMj23o/sA5nbg== Received: by filterdrecv-6f5868ff54-hh46f with SMTP id filterdrecv-6f5868ff54-hh46f-1-638F07A0-20 2022-12-06 09:13:04.554301981 +0000 UTC m=+1591572.399532680 Received: from herokuapp.com (unknown) by geopod-ismtpd-4-0 (SG) with ESMTP id Eusa-FpBQey4jO0GmQK7Og for ; Tue, 06 Dec 2022 09:13:04.504 +0000 (UTC) Date: Tue, 06 Dec 2022 09:13:04 +0000 (UTC) From: "ko1 (Koichi Sasada)" Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Feature X-Redmine-Issue-Id: 18798 X-Redmine-Issue-Author: ko1 X-Redmine-Sender: ko1 X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-Redmine-MailingListIntegration-Message-Ids: 87574 X-SG-EID: =?us-ascii?Q?YkmFGMrQnymZs=2F4gaHJnvrsFPAGAfVipS20r=2FEutHlZKBkOXJV3+2vYlfF3wrB?= =?us-ascii?Q?u+wzn1=2FYobjg0PO+JI9qcf52BlJbpWHheYAS0qN?= =?us-ascii?Q?W4A8+UK9Tr4D+rrCbrPgX1h=2Fw4ptWiPKrNap4iU?= =?us-ascii?Q?oJNp=2Fm7ioCergoHztwPUPwoK5OJ9R2AKTtA=2Fvy9?= =?us-ascii?Q?AWeg0T3Zd6uE6HTv=2FVJKQ4UkRh9F2j8TorTbtvQ?= =?us-ascii?Q?XiCToQ4U9KRz9D4qaCf2J2HpU0Db4H72CQ0YFml?= =?us-ascii?Q?UTbR=2F3NcILEP3WXU+vhZg=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== Message-ID-Hash: SLD73GN2D6IW7HN2DJYO4VWUDUZKWRV3 X-Message-ID-Hash: SLD73GN2D6IW7HN2DJYO4VWUDUZKWRV3 X-MailFrom: bounces+313651-b711-ruby-core=ml.ruby-lang.org@em5188.ruby-lang.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list Reply-To: Ruby developers Subject: [ruby-core:111219] [Ruby master Feature#18798] `UnboundMethod#==` with inherited classes List-Id: Ruby developers Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #18798 has been updated by ko1 (Koichi Sasada). Status changed from Open to Closed https://github.com/ruby/ruby/pull/6855 was merged. `p String.instance_method(:object_id) == Array.instance_method(:object_id) #=> true` ---------------------------------------- Feature #18798: `UnboundMethod#==` with inherited classes https://bugs.ruby-lang.org/issues/18798#change-100509 * Author: ko1 (Koichi Sasada) * Status: Closed * Priority: Normal ---------------------------------------- Now `UnboundMethod` for a same method from a superclass and an inherited class are not `==`. ```ruby class C def foo = :C $mc = instance_method(:foo) end class D < C $md = instance_method(:foo) end p $mc == $md #=> false p $mc.owner #=> C p $mc.owner == $md.owner #=> true p $mc.source_location == $md.source_location #=> true p $mc.inspect #=> "#" p $md.inspect #=> "#" ``` How about to make it `UnboundMethod#==` return true for this case? Rule: "return true if the UnboundMethod objects point to a same method definition" seems simple. FYI: On aliased unbound methods point to a same method are `==`. ```ruby class C def foo = :C alias bar foo $mfoo = instance_method(:foo) $mbar = instance_method(:bar) end p $mfoo, $mbar #=> # #=> # p $mfoo == $mbar #=> true ``` -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/