String.evalJSON is tightly coupled to the implementation of the method
itself, and where the implementation itself is soon likely to change
to be a wrapper for JSON.parse. We don't have methods such as
Number.toJavaScriptStringNotation etc. we have Number.toString.
String.evalJSON seems a bit too self-aware. Perhaps we could improve
the method name?

What about extracting the 'O' of JSON and just using that: i.e.

The same applies to Object.toJSON. What is JSON? A string
representation of an object. What about Object.toString? But
Object.toString exists already of course. I propose we override it.
This may sound horrendous (given Kangax's use of
Object.prototype.toString in Object.isArray) but perhaps it makes more
sense for Object.toString to return a JSON representation of an Object
than the current opaque string. Same for Array.toString etc.
Object.isArray can get access to Object.prototype.toString in its
closure before Object.toString is overrided. It would be great to be
able to do: ({name: "Prototype"}).toString() and '{"name":
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to