From: Pit Capitain Date: 2001-08-26T17:08:58+09:00 Subject: [ruby-talk:20391] Re: Freezing state in the Ruby interpreter (RCR?) On 26 Aug 2001, at 6:24, Michael Neumann wrote: > Jimmy Thrasher wrote: > > Unlike Java and Smalltalk, Ruby doesn't have any file/class > > bindings. So when one wants to, say, reload the contents of a class, > > checking for update, one can't guarantee that simply loading the > > file that the class was first found in would guarantee reloading of > > all the functionality that the class held, since other files could > > have given it more functionality. > > Maybe it's doable if we have a hook function that gets called whenever > a "class" keyword occurs. We simply remember the class being > extended/created and the current filename as well as the order in > which this happens. Of course we should also track the adding of > singleton methods, but that would complicate things a bit. > > Then at the end we can say which class is spread over which files, can > do a simple test if one of the files has changed, in this case we are > able reload all these files. If you don't mind exactly which classes to reload, maybe it is enough to remember only the files that have been loaded. I think it would be difficult to reload specific classes. If you have a ruby file introducing a new "behavior" that changes more than one existing class and/or module, and you want to reload only one of them. Would you reload the whole file or only the parts belonging to the reloaded class? But I think class reloading is not quite what Jimmy originally asked for. He started his post with class reloading, but then went on with freezing the interpreter. Maybe you were thinking of class / file reloading combined with some kind of continuations. Pit