Close review of Language Overview whitepaper

Kris Zyp kriszyp at xucia.com
Thu Nov 15 10:24:37 PST 2007


On Nov 15, 2007 9:58 AM, Brendan Eich <brendan at mozilla.org> wrote:

> On Nov 15, 2007, at 9:17 AM, Kris Zyp wrote:
>
> > +1 from me. One request: When a filter function is provided to
> > JSON.parse, I would like the filter to be called with |this|
> > defined to be the root object that is being created by the parsed
> Interesting -- a short example would help sell this, I bet.
>
Example: one could write a reference resolving filter that could handle JSON
referencing schemes for circular references and such.
obj = JSON.parse('{child:{$ref:"this"}}',function(k,v) {
   return k=='$ref' ? eval(v) : v; // non-eval resolvers could be used, but
this is succint
});
obj.child==obj -> true
This is really not a very big deal, it is easy to walk the tree after parse
to accomplish the same thing, I just figured that when a filter is called,
|this| must be something, why not something of value?

My expanded ideas on JSON referencing (not really relevant to ES4, just
FYI):
http://www.json.com/2007/10/19/json-referencing-proposal-and-library/ although
there are plenty of other ways to do it.
Kris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.mozilla.org/pipermail/es-discuss/attachments/20071115/d16af469/attachment-0002.html 


More information about the Es4-discuss mailing list