At a guess, I would say that all this means is that Shoes apps aren't sandboxed. It's just taking whatever file you give it and loading it, so the second time, it's running in the same Ruby instance, which has the classes loaded.
For how to fix it, you could just have the first line in your program undefine the class (class names are constants, Module has some method to remove a constant) if it's defined, before doing anything else. On Thu, Sep 18, 2008 at 1:32 PM, Joshua Choi <[EMAIL PROTECTED]> wrote: > As Shoes runs, does it remember objects in a persistent cache, even > when programs come and go? > > I am running Shoes r970 on Mac OS X. This is what was happening: I had > discovered that calling the lowercase version of a class in Shoes to > initialize the class only works on Widgets now. So this doesn't work > anymore: > > class OKButton < Button > def initialize > super 'OK' do > visit '/' > end > end > end > > Shoes.app do > okbutton > end > > ...So I changed it to this, but _while Shoes was still running_: > > class OKButton < Widget > def initialize > button 'OK' do > visit '/' > end > end > end > > Shoes.app do > okbutton > end > > When I reran the program through Shoes, though, Shoes raised a > superclass mismatch error, which was unexpected. However, _quitting > and reopening Shoes got rid of the problem_. > > Now that I think about it, this explains why my programs run much > faster the second and third times I run them in Shoes. Shoes must be > keeping persistent copies of the classes or objects, or maybe > compilations of the programs, when it still runs. This is very good > for speed. However, it makes me worry about more surprising behavior > that may happen, such as programs interfering with each other, if the > program's classes or compilations are persistent. > > Can there be documentation about how Shoes does this? It's resulted in > surprising behavior for me already, and I'm afraid more surprises are > in the future for those who keep running Shoes. Also, I can just > restart Shoes every time to prevent problems like this as I modify my > program, but it's kind of annoying. Can there be a switch to make > Shoes sandbox its programs so that it doesn't cache...whatever it > saves, and reloads completely every time? > > Or, I could just be completely mistaken, but in any case, more > documentation on what is happening would be lovely. > > Sincerely, > Joshua Choi >
