View previous topic :: View next topic |
Author |
Message |
BenHinkle
Joined: 27 Mar 2004 Posts: 76
|
Posted: Thu Jun 24, 2004 6:52 am Post subject: mango.io serializable |
|
|
Why does SerializableRegistry.enroll take an object reference? That means that when I start my program up I need to instaniate one of everything that might ever be deserialized. With classes that are tightly interdependent I might have to create a whole tree of objects just to register the root.
A registry of functions avoids that problem. Then instead of calling
object = registry[guid];
object = object.create(reader)
it becomes
createfcn = registry[guid];
object = createfcn(reader);
I would also like to pass guid to the createfcn but that isn't a big deal. |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Thu Jun 24, 2004 2:35 pm Post subject: |
|
|
I agree Ben.
See over here for the same gripe from me ("Mango Sucks ...") http://www.dsource.org/forums/viewtopic.php?t=157
I think it will change to a Proxy for the class instead, which might actually be the real concrete class for small instances. I was thinking about perhaps an ISerializableFactory interface or something along those lines.
The reason its currently a class and not a function (or delegate) is that there's actually several related tasks involved (read/write/create/identify). It just seemed to make more sense to me for them to be class members. Also, there's not usually that many kinds of classes that get deserialized within a given app (a few handfulls?), so I'm not sure that the overhead is such a bad thing. I could be completely wrong on both counts though. What do you think? I'm totally open to alternatives ... |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Sun Jun 27, 2004 2:09 am Post subject: |
|
|
Just a note that the ISerializable stuff will be renamed in Beta-8, and has matured appropriately from its initial simplistic incarnation. |
|
Back to top |
|
|
|