From: Steven Parkes Date: 2010-12-18T03:11:27+09:00 Subject: const lookup, autoloading, and scoping I'm trying to do nested class/module lookup by name and beginning to think it's not possible/clean in the face of autoloading. The lookup is typical/simple String => Module: cls = cls.split("::").inject(Object) {|scope, const_name| scope.const_get(const_name)} Trouble arrises when you use autoloading (the nested names aren't already defined) and someone creates a class of the same name at the top level/Object scope. In that case, the const_get will resolve to the top level rather than loading the nested object. (Actually, it'll occur if anyone creates a class of the same name in any parent ...) Alternatives seem to be: - don't use autoloading - eval a string to get the class (not sure if this even works) - unique-ify all your class names everywhere, not just per-scope Am I missing anything?