ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: nobu@ruby-lang.org
To: ruby-core@ruby-lang.org
Subject: [ruby-core:72608] [Ruby trunk - Bug #11878] Comparison of prepended modules
Date: Wed, 30 Dec 2015 01:01:59 +0000	[thread overview]
Message-ID: <redmine.journal-55861.20151230010158.84591bdd43ca7777@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-11878.20151226144408@ruby-lang.org

Issue #11878 has been updated by Nobuyoshi Nakada.

Description updated
Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN to 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: REQUIRED, 2.3: REQUIRED

----------------------------------------
Bug #11878: Comparison of prepended modules
https://bugs.ruby-lang.org/issues/11878#change-55861

* Author: Tsuyoshi Sawada
* Status: Closed
* Priority: Normal
* Assignee: Nobuyoshi Nakada
* 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/

  parent reply	other threads:[~2015-12-30  0:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-11878.20151226144408@ruby-lang.org>
2015-12-26 14:44 ` [ruby-core:72493] [Ruby trunk - Bug #11878] [Open] Comparison of prepended modules sawadatsuyoshi
2015-12-28 18:46 ` [ruby-core:72564] [Ruby trunk - Bug #11878] " ruby-core
2015-12-30  1:01 ` nobu [this message]
2015-12-30  4:28 ` [ruby-core:72609] " sawadatsuyoshi
2015-12-30  7:36 ` [ruby-core:72610] " nobu
2015-12-30  9:16 ` [ruby-core:72613] " sawadatsuyoshi
2016-04-13  7:02 ` [ruby-core:74923] [Ruby trunk Bug#11878][Assigned] " naruse
2019-12-23 15:57 ` [ruby-core:96436] [Ruby master Bug#11878] " mame
2019-12-23 16:38 ` [ruby-core:96437] " eregontp
2019-12-23 16:41 ` [ruby-core:96438] " eregontp
2019-12-24  7:19 ` [ruby-core:96454] " mame
2020-01-16  8:44 ` [ruby-core:96904] " matz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-55861.20151230010158.84591bdd43ca7777@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).