From: Dossy Date: 2003-01-04T22:11:53+09:00 Subject: Re: dump depth argument On 2003.01.04, Tom Sawyer wrote: > > as for the hard limit, i agree. why raise an error? why not just stop > there? well, i'm going to try to get it to do just that. with any > luck i can rescue the error and flush what i have. we'll see. When using the version of Marshal#dump that takes anIO as an arg, I noticed that it /does/ write to anIO up until the limit is reached. So, if you rescue the exception, what's contained in anIO should be the Marshalled result until the limit was hit. However, this won't do the right thing in all cases: it seems to hard-stop at the /first/ member variable that exceeds the depth. It seems the only value of the limit arg to Marshal#dump is when you are dumping a recursive class and want to avoid trying to dump something with recursion too deep (use up too much disk, CPU time, etc.) so the limit is simply a guard. Marshalling out an object with a soft limit is a bad idea, because the subsequent Marshal#load won't produce an identical object as the one that was Marshal#dump'ed. I always thought that one of the required properties of pushing an object through Marshal#dump then Marshal#load is that it produces a deep copy of the original object ... -- Dossy -- Dossy Shiobara mail: dossy@panoptic.com Panoptic Computer Network web: http://www.panoptic.com/ "He realized the fastest way to change is to laugh at your own folly -- then you can let go and quickly move on." (p. 70)