Why go through such convoluted hoops? The problem is simple: the original module 
has a bug (it doesn't call super). All you have to do is fix the bug:

   module A
     alias buggy_initialize initialize
     def initialize
       super
       buggy_initialize
     end
   end

That's a lot cleaner than undefining and redefining constants.

BTW I suggest that a module's initialize should always pass through parameters 
to the upper level:

   def initialize(*a,&b)
     super
     #do your stuff...
   end

And if Matz is reading this, I wish that 'call super' would be the *default* 
behavior. ^_^

Daniel

Jonas Pfenniger wrote:
> Thanks for your help,
> 
> I finally decided to create a new Module#insert method :
> 
> class Module
>  def insert(new_mod)
>    new_mod = new_mod.dup
>    old_mod = self
>    mod_name = self.basename
> 
>    new_mod.module_eval do
>      include old_mod
>    end
> 
>    (nesting[-2] || Object).module_eval do
>      remove_const mod_name
>      const_set mod_name, new_mod
>    end
>  end