From: Joel VanderWerf Date: 2006-02-04T05:34:01+09:00 Subject: Re: [YAML] serializing Class and Module objects why the lucky stiff wrote: > Joel VanderWerf wrote: > >> Hey, _why, what do you think about allowing YAML to dump/load Class and >> Module objects rather than gagging? I've posted code like the following >> (different versions for 1.8.2 and 1.8.4) several times in response to >> inquiries on ruby-talk, and found it useful myself. >> >> > I've been reluctant, because reloading these objects causes trouble if > you haven't required the right libraries. But I think if YAML's error > message was okay, it would work. I thought about rescuing and re-raising the exception as a different exception class, but maybe it is better to leave it as it is: NameError: uninitialized constant Foo This is the same exception you would get if you loaded a script file. The way Marshal does it (in the case of a dumped class that is loaded without having the class definition required) is: ArgumentError: undefined class/module Foo Maybe that's how YAML should do it for consistency? I'd be happy with either way. > Oh and the best place for getting Syck requests through is now here: > http://code.whytheluckystiff.net/syck/newticket Thanks! -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407