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!
>=20
> Why has defined? been changed for autoloaded constants in 1.9?
>=20
> In 1.8 the following prints "constant":
>=20
> autoload :A, 'a'
> puts defined?(A)
>=20
> In 1.9 it prints nil.
>=20
> Why the change?  I can see how it makes sense, sort of, but I have a test=
 for
>=20
> defined? ::Gem::Specification
>=20
> to test whether RubyGems has been loaded.
>=20
> 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=92s
> a new way one should use for performing tests for loaded features like
> this one.)
>=20
> Thanks!
>=20