So here's a crazy idea (how's that for a lead-in?): What if it were possible to specify that you want all non-array JSON objects to be revived as maps instead of objects? Perhaps as an option passed to JSON.parse()? JSON objects really have no use for prototypes and could just as easily be represented as maps. You certainly wouldn't want that by default, but as an option, maybe it could make sense.

-N

On 10/3/2012 11:44 AM, Dean Landolt wrote:


On Wed, Oct 3, 2012 at 2:19 PM, Rick Waldron <waldron.r...@gmail.com <mailto:waldron.r...@gmail.com>> wrote:



    On Wed, Oct 3, 2012 at 2:04 PM, Rick Waldron
    <waldron.r...@gmail.com <mailto:waldron.r...@gmail.com>> wrote:



        On Wed, Oct 3, 2012 at 1:43 PM, Brandon Benvie
        <bran...@brandonbenvie.com <mailto:bran...@brandonbenvie.com>>
        wrote:

            Another options for Maps is to represent them as an array
            of [key, value].


        Which is a rough approximation of what a Map looks like
        internally.



    Sorry, this is incorrect. Map looks more like:

    [key1, key2]
    [value1, value2]

    Sorry for confusion


I image it looking something like [key1, value1, key2, value2...] -- index % 2 implies values. Anything more would mean an awful lot of unnecessary allocations. I don't see why this wouldn't be sufficient for the json form as well, especially if the language had something like a take2 iterator.


_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

--
___________________________
Nicholas C. Zakas
http://www.nczonline.net

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to