iteration order for Object
jat at google.com
Fri Mar 11 11:56:47 PST 2011
On Fri, Mar 11, 2011 at 2:49 PM, Charles Kendrick <charles at isomorphic.com>wrote:
> Hello John, I'll assume you meant this as humor since the analogy has such
> obvious flaws.
> Having a default strategy on Object of maintaining order obviously does not
> itself, as locking int to 16 bits would obviously have damaged C by
> requiring various new types.
There is a non-zero cost of maintaining insertion order, and doing so
introduces many edge cases that have been discussed. The most obvious
implementation of object properties is a hash map, which does not support
what you want.
Aside from the technical issues, the point remains that if you write code
that depends on unspecified implementation details, you should not expect
that code to be portable.
I think analogy with C is appropriate -- the sizes and implementation
details of basic types were left unspecified, largely because specifying a
particular size or representation would have made it inefficient to
implement on some platforms. Sure, that meant that people had to define
their own int16/int32/etc types where they cared and certainly some people
wrote code assuming twos-complement or int/pointer equivalence and were
surprised when the code didn't run on some other platform, but it also
allowed the language to be efficiently implemented on lots of different
platforms and to grow to platforms never imagined when it was first
John A. Tamplin
Software Engineer (GWT), Google
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss