diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb
index 5e55543d09d6590b80e7d59db384b025ee1b710d..b56d190a00a7debfabdec54d08bde71e470ac352 100644
--- a/Library/Homebrew/formulary.rb
+++ b/Library/Homebrew/formulary.rb
@@ -1,3 +1,5 @@
+require "digest/md5"
+
 # The Formulary is responsible for creating instances of Formula.
 # It is not meant to be used directy from formulae.
 
@@ -14,6 +16,7 @@ class Formulary
 
   def self.load_formula(name, path)
     mod = Module.new
+    const_set("FormulaNamespace#{Digest::MD5.hexdigest(path.to_s)}", mod)
     mod.module_eval(path.read, path)
     class_name = class_s(name)