Sets plus JSON

Nicholas C. Zakas standards at nczconsulting.com
Wed Oct 3 11:49:46 PDT 2012


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.rick at gmail.com 
> <mailto:waldron.rick at gmail.com>> wrote:
>
>
>
>     On Wed, Oct 3, 2012 at 2:04 PM, Rick Waldron
>     <waldron.rick at gmail.com <mailto:waldron.rick at gmail.com>> wrote:
>
>
>
>         On Wed, Oct 3, 2012 at 1:43 PM, Brandon Benvie
>         <brandon at brandonbenvie.com <mailto:brandon at 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 at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121003/ff69f279/attachment.html>


More information about the es-discuss mailing list