On Thu, 18 Sep 2008, Joshua Choi wrote:

> As Shoes runs, does it remember objects in a persistent cache, even
> when programs come and go?

Not to my knowledge.  In my casual browsing of the source I've not noticed
anything.
> 
> 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

"only"! I didn't know you could do that at all.  In ruby a lowercase
name is just a method, but it may have nothing to do with any particular
class.

> 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

I've looked at that pretty carefully and they look the same to me.

> 
> When I reran the program through Shoes, though, Shoes raised a

How exactly did you do that?  If your program was running, then the
initial shoes dialogue goes away, so you just have the interface you
wrote. 

If you reload a program ruby should just take the nev version.  You 
can extend objects at runtime, remember...

> superclass mismatch error, which was unexpected. However, _quitting

Do you have the exact text of the error?  

> 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

Lua (actually luac) and Python do that, but they put the compiled
bytecode files out to disk.

> 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.

If a ruby program reads files with the same classes in, the classes
get extended.  Yes, this can lead to problems.
> 
> 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
> 
        Hugh

Reply via email to