From: Sylvain Joyeux Date: 2007-03-20T17:27:59+09:00 Subject: Re: [ ruby-Bugs-9376 ] Marshal.dump shouldn't complain about singletons if the _dump method is defined > |> I am not sure if we know what we are doing here. Dumping objects > |> without singleton information may trigger serious problems, that can > |> happen too easily. > |I don't see why as soon as the dumping/loading is done by user code. I > |defined _dump, if the singleton state is important, it is my job to > | save it anyway. So ... > In most of my use case, singleton behavior/attribute is fundamental to > the object. For example, ARGF is an instance of plain Object, even if > it works like an IO. I don't want get an empty object when I dumped > ARGF. I'd rather get an error. _dump is not explicitely defined on ARGF. I don't have any problem with Ruby not dumping it in that case. My problem is that if _dump is defined, it is because the object dumping procedure is custom anyway. If there is singleton state to save, it is the programmer responsibility, not Ruby's. > |> You can define its own marshal_dump method if you really want to dump > |> the object. > |No you can't, or I wrongly guessed how marshal_dump should be defined > |(marshal_dump and _dump are really not documented enough) > My mistake. Now I think it should behave so. Will fix. While you're at it, could you explain the difference between _dump and marshal_dump ? I googled a bit and found nothing ... Thanks a lot Sylvain