From: "nobu (Nobuyoshi Nakada)" Date: 2012-03-18T23:43:29+09:00 Subject: [ruby-core:43452] [ruby-trunk - Bug #6172][Rejected] Inconsistent behaviour of defined? Issue #6172 has been updated by nobu (Nobuyoshi Nakada). Status changed from Open to Rejected The former is analogous to Foo.bar(Misio), while the latter is analogous to Foo.bar("zot"). Object.const_get is mere method call. ---------------------------------------- Bug #6172: Inconsistent behaviour of defined? https://bugs.ruby-lang.org/issues/6172#change-24920 Author: pkondzior (Pawe�� Kondzior) Status: Rejected Priority: Normal Assignee: Category: core Target version: 2.0.0 ruby -v: ruby 2.0.0dev (2012-03-18 trunk 35081) [x86_64-darwin11.2.0] Following behavior is obvious: irb(main):004:0> Object.const_get("Misio") NameError: uninitialized constant Misio from (irb):4:in `const_get' from (irb):4 from /Users/pawel/.rbenv/versions/1.9.4-dev/bin/irb:12:in `
' irb(main):005:0> Object.const_get(Misio) NameError: uninitialized constant Misio from (irb):5 from /Users/pawel/.rbenv/versions/1.9.4-dev/bin/irb:12:in `
' Both cases throws an exception, obviously with different backtrace because execution paths are different. But following behavior is doesn't make sens at all for: irb(main):001:0> defined?(Object.const_get(Misio)) => nil irb(main):002:0> defined?(Object.const_get("Misio")) => "method" Shouldn't defined?(Object.const_get("Misio")) return also nil ? -- http://bugs.ruby-lang.org/