dhtmlkitchen at gmail.com
Sat Sep 1 18:25:56 PDT 2007
I was wondering about the new JSON methods:
to me, parseJSON seems like it should not be a String prototype method.
I'm thinking about other "parse" type of methods, like Date.parse( s );
Here, it's fairly obvious what parse should return -- A Date.
A parse method always parses a string, and in any well-designed API,
returns an object of the class it's bound to. We've already seen this
with Date.parse(), in other languages, like Java, there are
It seems to me to make more sense to put parseJSON on object, but then
since JSON is a subset of Object, why not just put it as a subclass of
It seems to me, that Object.prototype.toJSONString could be also
implemented on a JSON instance.
JSON( object )
static JSON parse( s ) throws SyntaxError
Programming is a collaborative art.
More information about the Es4-discuss