On 2/14/07, Rush Manbert <[EMAIL PROTECTED]> wrote:
>
> This is OT, but I AM using MochiKit and you folks are such JavaScript
> hotshots that I thought I would ask here.
>
> For reasons very particular to my application, I have a JavaScript
> framework that defines 3 object types. Objects of type B contain an
> array of objects of type A, and object type C contains an array of
> objects of type B. The objects have function members and the framework
> maintains a single instance of class C that represents state
> information. The state info is refreshed via loadJSONDoc.
>
> When I first put it all together, I wondered how eval() knew what object
> type the JSON string represented. It looked like magic. Until I
> refreshed my object, then tried to call one of its member functions. As
> you all know, there were no functions. The deserialized objects are just
> data. So it's not magic, after all, and I was right to doubt that it
> would do what I wanted.
>
> My question is, how do other people deal with this issue? I can write
> constructors that will build "full" objects from the "data only"
> objects, sort if like a copy constructor in C++. Is there some better
> approach?

That's what you have to do. Traverse the object graph and transform it
into what you want.

-bob

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to