Forum: Ruby-core [ruby-trunk - Bug #7700][Open] Assignment to an Constant does not give an singleton_class its name

Posted by Hans Mackowiak (hanmac)
on 2013-01-15 07:57
(Received via mailing list)
Issue #7700 has been reported by Hanmac (Hans Mackowiak).

----------------------------------------
Bug #7700: Assignment to an Constant does not give an singleton_class 
its name
https://bugs.ruby-lang.org/issues/7700

Author: Hanmac (Hans Mackowiak)
Status: Open
Priority: Low
Assignee:
Category:
Target version:
ruby -v: ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]


object = Object.new

ABC = object.singleton_class

class ABC
  module D
  end
end

class << object
  module E
  end
end

p ABC #=> #<Class:#<Object:0x00000001957c88>>
p ABC::D #=> ABC::D
p ABC::E #=> ABC::E

as you guys can see, and module into an singleton class get its right 
name, but the singleton_class itself does not get its name
Posted by Nobuyoshi Nakada (nobu)
on 2013-01-17 11:37
(Received via mailing list)
Issue #7700 has been updated by nobu (Nobuyoshi Nakada).

Status changed from Open to Rejected

It's an intended behavior.
`ABC.name' gives "ABC" instead.
----------------------------------------
Bug #7700: Assignment to an Constant does not give an singleton_class 
its name
https://bugs.ruby-lang.org/issues/7700#change-35458

Author: Hanmac (Hans Mackowiak)
Status: Rejected
Priority: Low
Assignee:
Category:
Target version:
ruby -v: ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]


object = Object.new

ABC = object.singleton_class

class ABC
  module D
  end
end

class << object
  module E
  end
end

p ABC #=> #<Class:#<Object:0x00000001957c88>>
p ABC::D #=> ABC::D
p ABC::E #=> ABC::E

as you guys can see, and module into an singleton class get its right 
name, but the singleton_class itself does not get its name
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.