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: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 657851F466 for ; Thu, 16 Jan 2020 08:44:09 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id C1225120C16; Thu, 16 Jan 2020 17:43:54 +0900 (JST) Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by neon.ruby-lang.org (Postfix) with ESMTPS id B8ACD120C15 for ; Thu, 16 Jan 2020 17:43:52 +0900 (JST) Received: by filterdrecv-p3iad2-57f487d66-kg6ck with SMTP id filterdrecv-p3iad2-57f487d66-kg6ck-17-5E202250-2C 2020-01-16 08:44:00.563250408 +0000 UTC m=+2620637.856853431 Received: from herokuapp.com (unknown [54.158.130.18]) by ismtpd0046p1mdw1.sendgrid.net (SG) with ESMTP id s5LBwtVgTXC098mrpCH3_g for ; Thu, 16 Jan 2020 08:44:00.459 +0000 (UTC) Date: Thu, 16 Jan 2020 08:44:00 +0000 (UTC) From: matz@ruby.or.jp Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 72566 X-Redmine-Project: ruby-master X-Redmine-Issue-Id: 11878 X-Redmine-Issue-Author: sawa X-Redmine-Issue-Assignee: matz X-Redmine-Sender: matz 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-SG-EID: =?us-ascii?Q?bXEIHGfdFwsIlBTndiToCp=2Fmc2rfxRD2sZAksRKJIHXsLeZ+qy+oofkiRvreH8?= =?us-ascii?Q?RWaS6vI5NHUcG3YVENei7NC1FBvwdPkEXAVhIAh?= =?us-ascii?Q?ODHaSm33vz6RbafQ4wf+pxU+q5L+NILOStV+Goe?= =?us-ascii?Q?cpP4sE2Jty4lIaWp4Qdb3wGDSVuqHjlfq4oz4vc?= =?us-ascii?Q?JU=2F8r9DyjJ+ttAkslEN9+87scGoyWJZDEKQ=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 96904 Subject: [ruby-core:96904] [Ruby master Bug#11878] Comparison of prepended modules X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #11878 has been updated by matz (Yukihiro Matsumoto). Status changed from Open to Rejected For the code like below: ``` module A; end module I include A end p A < I #=> false p A > I #=> true module P prepend A end # current: same as include p A < P #=> false p A > P #=> true ``` `A > P` does not mean `P` is a subclass of `A`, but `P` *includes* the method sets defined in `A`. So the current behavior should not be changed. Matz. ---------------------------------------- Bug #11878: Comparison of prepended modules https://bugs.ruby-lang.org/issues/11878#change-83920 * Author: sawa (Tsuyoshi Sawada) * Status: Rejected * Priority: Normal * Assignee: matz (Yukihiro Matsumoto) * Target version: * ruby -v: 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux] * Backport: 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: REQUIRED, 2.3: REQUIRED ---------------------------------------- Including module `B` to class/module `A` gives the following results (as expected): ~~~ruby module A; end module B; end A.include B A < B # => true B < A # => false A <=> B # => -1 ~~~ And prepending module `C` to `A` gives the following results: ~~~ruby module C; end A.prepend C A < C # => true C < A # => nil A <=> C # => -1 ~~~ It looks like including and prepending almost do not make difference with respect to module comparison, i.e., `A < B` and `A < C` are the same, and `A <=> B` and `A <=> C` are the same. However, then, the difference between `B < A` and `C < A` stands out unexplained. I suppose this is a bug. If `C < A` were to return `false`, then it would be at least consistent. However, if that was what was intended, then at least to me, it is strange. In that case, I would like to make this a feature request. I would rather expect: ~~~ruby A < C # => false C < A # => true A <=> C # => 1 ~~~ -- https://bugs.ruby-lang.org/