ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:53171] [ruby-trunk - Feature #8035][Open] singleton class should be included in ancestors
@ 2013-03-06 16:51 marcandre (Marc-Andre Lafortune)
  2013-03-06 19:21 ` [ruby-core:53172] [ruby-trunk - Feature #8035] " alexeymuranov (Alexey Muranov)
  2013-03-07 13:19 ` [ruby-core:53190] " matz (Yukihiro Matsumoto)
  0 siblings, 2 replies; 3+ messages in thread
From: marcandre (Marc-Andre Lafortune) @ 2013-03-06 16:51 UTC (permalink / raw
  To: ruby-core


Issue #8035 has been reported by marcandre (Marc-Andre Lafortune).

----------------------------------------
Feature #8035: singleton class should be included in ancestors
https://bugs.ruby-lang.org/issues/8035

Author: marcandre (Marc-Andre Lafortune)
Status: Open
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: current: 2.1.0


I feel it would be consistent if:

    k.ancestors.include?(k) #=> always true if k.is_a?(Class)

This is currently the case except for singleton classes:

    class << ""; include Enumerable; end.ancestors
    # => [Enumerable, String, Comparable, Object, Kernel, BasicObject]
    # would be more consistent:
    # => [#<Class:#<String:0x0000010113d268>>, Enumerable, String, Comparable, Object, Kernel, BasicObject]

Note that the singleton classes do appear in the ancestors if a module is instead prepended:

    class << ""; prepend Enumerable; end.ancestors
    # => [Enumerable, #<Class:#<String:0x0000010113d268>>, String, Comparable, Object, Kernel, BasicObject]

Thanks


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-core:53172] [ruby-trunk - Feature #8035] singleton class should be included in ancestors
  2013-03-06 16:51 [ruby-core:53171] [ruby-trunk - Feature #8035][Open] singleton class should be included in ancestors marcandre (Marc-Andre Lafortune)
@ 2013-03-06 19:21 ` alexeymuranov (Alexey Muranov)
  2013-03-07 13:19 ` [ruby-core:53190] " matz (Yukihiro Matsumoto)
  1 sibling, 0 replies; 3+ messages in thread
From: alexeymuranov (Alexey Muranov) @ 2013-03-06 19:21 UTC (permalink / raw
  To: ruby-core


Issue #8035 has been updated by alexeymuranov (Alexey Muranov).


Singleton class it the same thing as metaclass, right?  I feel it would be better to keep it invisible, and maybe in the future to remove it completely and to allow objects to keep their singleton methods themselves.
----------------------------------------
Feature #8035: singleton class should be included in ancestors
https://bugs.ruby-lang.org/issues/8035#change-37333

Author: marcandre (Marc-Andre Lafortune)
Status: Open
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: current: 2.1.0


I feel it would be consistent if:

    k.ancestors.include?(k) #=> always true if k.is_a?(Class)

This is currently the case except for singleton classes:

    class << ""; include Enumerable; end.ancestors
    # => [Enumerable, String, Comparable, Object, Kernel, BasicObject]
    # would be more consistent:
    # => [#<Class:#<String:0x0000010113d268>>, Enumerable, String, Comparable, Object, Kernel, BasicObject]

Note that the singleton classes do appear in the ancestors if a module is instead prepended:

    class << ""; prepend Enumerable; end.ancestors
    # => [Enumerable, #<Class:#<String:0x0000010113d268>>, String, Comparable, Object, Kernel, BasicObject]

Thanks


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-core:53190] [ruby-trunk - Feature #8035] singleton class should be included in ancestors
  2013-03-06 16:51 [ruby-core:53171] [ruby-trunk - Feature #8035][Open] singleton class should be included in ancestors marcandre (Marc-Andre Lafortune)
  2013-03-06 19:21 ` [ruby-core:53172] [ruby-trunk - Feature #8035] " alexeymuranov (Alexey Muranov)
@ 2013-03-07 13:19 ` matz (Yukihiro Matsumoto)
  1 sibling, 0 replies; 3+ messages in thread
From: matz (Yukihiro Matsumoto) @ 2013-03-07 13:19 UTC (permalink / raw
  To: ruby-core


Issue #8035 has been updated by matz (Yukihiro Matsumoto).


Agreed.  I will accept it unless any other compatibility problem raises.

Matz.

----------------------------------------
Feature #8035: singleton class should be included in ancestors
https://bugs.ruby-lang.org/issues/8035#change-37358

Author: marcandre (Marc-Andre Lafortune)
Status: Open
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: current: 2.1.0


I feel it would be consistent if:

    k.ancestors.include?(k) #=> always true if k.is_a?(Class)

This is currently the case except for singleton classes:

    class << ""; include Enumerable; end.ancestors
    # => [Enumerable, String, Comparable, Object, Kernel, BasicObject]
    # would be more consistent:
    # => [#<Class:#<String:0x0000010113d268>>, Enumerable, String, Comparable, Object, Kernel, BasicObject]

Note that the singleton classes do appear in the ancestors if a module is instead prepended:

    class << ""; prepend Enumerable; end.ancestors
    # => [Enumerable, #<Class:#<String:0x0000010113d268>>, String, Comparable, Object, Kernel, BasicObject]

Thanks


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-03-07 13:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-06 16:51 [ruby-core:53171] [ruby-trunk - Feature #8035][Open] singleton class should be included in ancestors marcandre (Marc-Andre Lafortune)
2013-03-06 19:21 ` [ruby-core:53172] [ruby-trunk - Feature #8035] " alexeymuranov (Alexey Muranov)
2013-03-07 13:19 ` [ruby-core:53190] " matz (Yukihiro Matsumoto)

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).