Subj : Re: [SpiderMonkey] Serializing JSObject To : ggadwa@charter.net From : Brendan Eich Date : Wed Jun 23 2004 02:50 pm ggadwa@charter.net wrote: > Brendan Eich wrote: > >> Since you are dealing with an implementation of the language here, >> namely SpiderMonkey, you might rather use JSVAL_IS_INT, >> JSVAL_IS_DOUBLE, etc., than JS_TypeOfValue. > > > Ah ... okey dokey. I use JS_TypeOfValue to filter out the things I > don't want to serialize (i.e., functions, and currently, objects, though > that will change.) I use the _IS_ to filter it down further. That > makes sense to me. You would save cycles by skipping the JS_TypeOfValue filtering. >> Generally, serialization is domain-specific. > > > If you did it a compact way, it would be. No, I meant it requires knowledge of JSClass-specific private data, other JSObjectOps variations on object structure, and in general, issues to do with scope chain and other runtime parameters. > I'm basically generating > strings that are ... to a point ... human readable. Have you looked at uneval, which is built on toSource for object types? > Yeah, but everything seems to be more complex then it needs to be :) > Surely, there's good reason, but what I think is useful is just two > function calls that take a JSObject, return a string, and the opposite. > Nothing else to be done. This sounds awfully like uneval and eval to me. /be .