On Mon, Jul 30, 2001 at 08:08:37PM +0900, Nat Pryce wrote:
> It would  useful enough if Marshal knew how to load classes from the search
> path, similar to Tcl's auto-load mechanism for automatically loading
> procedures.  However, with Ruby's open classes, class loading is more
> complex than it is in Java for example.  Parts of the same class can be
> defined in multiple files and there is no easy way to tell which file
> contains the "canonical" definition of a class and which optional extensions
> to the class.  Perhaps the each package could include a file containing an
> explicit mapping from class names to source files to be used by the class
> loader.  I can see that being a maintenance problem, although that problem
> could itself be alleviated with tool support.

Is it possible to define a callback which is called every time a class
definition is changed (either via including, or eval()-ing, or some other
method)?

This would make it possible to store a list of all files modifying a class,
and load them (in the same order) before doing Marshal.load().

If the modifications are conditional (e.g. depending on user input), this
still wont work, but I guess its the best we can get...

How does ruby store the class definitions internally? Maybe those could be
marshaled somehow...?

greetings, Florian Pflug