From: sawadatsuyoshi@gmail.com
To: ruby-core@ruby-lang.org
Subject: [ruby-core:72493] [Ruby trunk - Bug #11878] [Open] Comparison of prepended modules
Date: Sat, 26 Dec 2015 14:44:10 +0000 [thread overview]
Message-ID: <redmine.issue-11878.20151226144408.0cdde24a8ea8aab3@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-11878.20151226144408@ruby-lang.org
Issue #11878 has been reported by Tsuyoshi Sawada.
----------------------------------------
Bug #11878: Comparison of prepended modules
https://bugs.ruby-lang.org/issues/11878
* Author: Tsuyoshi Sawada
* Status: Open
* Priority: Normal
* Assignee:
* ruby -v: 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
Including module `B` to class/module `A` gives the following results (as expected):
~~~
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:
~~~
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:
~~~
A < C # => false
C < A # => true
A <=> C # => 1
~~~
--
https://bugs.ruby-lang.org/
next parent reply other threads:[~2015-12-26 14:11 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 ` sawadatsuyoshi [this message]
2015-12-28 18:46 ` [ruby-core:72564] [Ruby trunk - Bug #11878] Comparison of prepended modules ruby-core
2015-12-30 1:01 ` [ruby-core:72608] " nobu
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.issue-11878.20151226144408.0cdde24a8ea8aab3@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).