----- Original Message ----- From: "Ned Konz" <ned / bike-nomad.com> > On Sunday 29 July 2001 06:00 pm, Florian Pflug wrote: > > Has anyone written a library or module which enables Marshal to > > automatically load classes (or rather the files containing classes), which > > are not available when doing Marshal.load()? > > How would you do this in general? Since Ruby classes and methods can come > from dynamically evaluated strings, you'd have to capture every bit of text > that was compiled if you wanted to have a general solution. 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.