Hello!

It seems there is a problem with nested modules and requiring them in shoes.

Let's assume you have two files:
mod.rb
app.rb

--- mod.rb: ---
module Inner
  class Boo
  end
end
--- end---

--- app.rb ---
require "mod"

module Outer
  module Foo
    def self.getBoo
      Inner::Boo.new
    end
  end
end

Shoes.app do
  para "test: #{Outer::Foo.getBoo.inspect}"
end
--- end ---

So far so good. But if you change the mod.rb (first file) to something like this:

--- mod.rb: ---
module Outer
  module Inner
    class Boo
    end
  end
end
--- end---

Shoes will show you the "uninitialized constant..." in the console. It seems this problem occurs only if we use the same outer module name (here "Outer"). If you change the mod.rb's Outer module to, for example Outer2, the code will run normally (you will have to change the getBoo to have: "Outer2::Inner::Boo.new").

Looks like a bug isn't it? A bit annoying one because I tend to organize namespaces in modules (a Java habit, but I think a good one ;). Therefore I often have bigger code parts splited into different files and enclosed within a common (module) name.

best regards
sw

PS.
I had a problem with "resolv-replace.rb". I resolve it after the why's hint: http://www.mail-archive.com/[email protected]/msg02786.html . I'm on MacOSX and now it works ok, however I'm wondering will it run under Windows? Linux? I use open-uri to get to some data through http. I tried to use Shoes download method and got error 421(temporary unavailable) from the server. Does Shoes use a kind of proxy while performing the "download" method?

Reply via email to