From: Aaron Patterson Date: 2011-02-23T08:41:41+09:00 Subject: [ruby-core:35343] Re: odd require behavior --XsQoSWH+UP9D9v3l Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Feb 23, 2011 at 04:05:46AM +0900, Roger Pack wrote: > Hello all. > In trunk "Queue" appears to be a native class. > In 1.9.2, its require causes an odd result: >=20 >=20 > >> Queue > NameError: uninitialized constant Object::Queue > from (irb):1 > from D:/Ruby192/bin/irb:12:in `
' > >> require 'queue' > LoadError: no such file to load -- queue > from :29:in `require' > from :29:in `require' > from (irb):2 > from D:/Ruby192/bin/irb:12:in `
' > >> Queue # it appears it was actually successful... > =3D> Queue > >> RUBY_DESCRIPTION > =3D> "ruby 1.9.2p136 (2010-12-25) [i386-mingw32]" >=20 > Any hints out there? This is probably due to rubygems requiring "thread". I suspect that when you do the "require 'queue'", rubygems gets activated (attempting to find the "queue.rb" file). When rubygems is activated, it requires thread, which contains Queue. $ irb irb(main):001:0> Queue NameError: uninitialized constant Object::Queue from (irb):1 from /Users/aaron/.ruby19/bin/irb:12:in `
' irb(main):002:0> require 'thread' =3D> true irb(main):003:0> Queue =3D> Queue irb(main):004:0> exit $ irb irb(main):001:0> require 'rubygems' =3D> true irb(main):002:0> Queue =3D> Queue irb(main):003:0> Note that when rubygems stops requiring thread, this example will fail. --=20 Aaron Patterson http://tenderlovemaking.com/ --XsQoSWH+UP9D9v3l Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (Darwin) iQEcBAEBAgAGBQJNZEmwAAoJEJUxcLy0/6/GuxEIAJbzv42PgzX0IegvNYb73Xvs 4yKp8aFvOgYEosmXtajw/bQViKiqEriXpvbT80gVHvWjmgPQ7jpkZ7v7e9qlIbev fyAvkea9krjZ84xJOn9vwyvzFmGHnruxxZ70PuVkgqygeuPvOzO+opEzgvPwfvr6 BwLvWNnl9Jz/2zLHAXfYVL8ZQyYcaiYfXJ4hg+0aejCczuby8hZQtu2USo4o0FNG exDOYUBlH79vQ45ffPSPYLVF7yaywFp3QJBH3cjTq0DpJX4KP21EsqeXvjGkCSj3 wtXGLqRNXTn5yddlXVvumO1lbuyjsx4pFdHMUvX4onCyNlfGcpRNEkLRrVz6/vU= =Rhxj -----END PGP SIGNATURE----- --XsQoSWH+UP9D9v3l--