It has probably changed so you can autoload stuff like this: module Foo; end undless defined? Foo Konstantin On Mar 17, 2011, at 10:14 , Nikolai Weibull wrote: > Hi! > > Why has defined? been changed for autoloaded constants in 1.9? > > In 1.8 the following prints "constant": > > autoload :A, 'a' > puts defined?(A) > > In 1.9 it prints nil. > > Why the change? I can see how it makes sense, sort of, but I have a testor > > defined? ::Gem::Specification > > to test whether RubyGems has been loaded. > > How do I perform this test in 1.9? (I could of course change the test > to the less restrictive defined? ::Gem, but I want to know if thereÃÔ > a new way one should use for performing tests for loaded features like > this one.) > > Thanks! >