On Mon, Mar 5, 2012 at 12:45 PM, gaz Heyes <[email protected]> wrote:
> It's a shame that "this" doesn't work with object literals :(
> How nice would this be:
>
> {
> "a":123,
> "b": this.a
> }
Not nice. Not nice at all.
Try reading:
{ "a" : this.b,
..... long object ....
"b" : 42,
..... more long object ....
}
Then try omitting the "b".
And then try
{"a" : this.b,
"b" : this.a }
Good luck debugging!
JSON literals, as currently designed, can't fail. They always describe
a value. All of these suggestions introduces ways to make syntax that
doesn't necessarily describe a value. In order to make a reference to
another object, you need two things to be in sync, either a tag/ref
pair or a path that must match the actual structure.
If you need cyclic structures or DAGs, perhaps JSON is not for you :)
/L 'and JSON isn't controlled by this group anyway'
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss