brendan at mozilla.org
Thu Jun 5 13:39:41 PDT 2008
Using Lars's reply to respond to Mark's proposal, since it was not
cross-posted. Mark's proposal text, one level of cite-quotation
> -----Original Message-----
> From: Mark S. Miller [mailto:erights at google.com]
> Sent: 4. juni 2008 17:59
> To: Douglas Crockford
> Cc: Lars Hansen; es3.x-discuss at mozilla.org; brendan at mozilla.org
> Subject: Re: Member Ordering
> On Wed, Jun 4, 2008 at 8:42 AM, Douglas Crockford
> <douglas at crockford.com> wrote:
>> That is indeed discouraging. Perhaps ES3 did the right thing by
>> leaving the order unspecified.
> No. Please specify some deterministic order. I don't much care which.
> But leaving it unspecified complicates testing unnecessarily.
> Also, please see <http://www.cs.berkeley.edu/~amettler/purecomp.pdf>
> (draft paper) for further benefits that can only be realized
> after removing such unavoidable sources of hidden
> non-determinism. (Brendan, I've added you to the cc to make
> sure you see this paper. It makes another interesting bridge
> between information-flow and ocaps.)
I agree that we need to specify more than what ES1-3 specified.
The de-facto standard of insertion order remains mandatory, as far as
I can tell, for most objects and named properties. You can't make a
web-compatible browser without it.
But index-named properties, specifically in Array instances, could be
treated differently -- maybe. We'll find out with very-large-scale
Firefox 3 testing how often any web content cares that index order is
not necessarily insertion order.
> A proposal:
> * For direct instances of Array: Use the Opera ordering for
> the own properties. Then the normal prototype-following
> insertion order for ascending the superclass chain. Note that
> Array.prototype is not an instance of Array, and so should
> enumerate by insertion order.
Array.prototype is an Array instance, but with a [[Prototype]]
linking to Object.prototype instead of to Array.prototype (as all
other Array instances have) -- see ECMA-262 Edition 3 15.4.4, first
15.4.4 Properties of the Array Prototype Object
The value of the internal [[Prototype]] property of the Array
prototype object is the Object prototype object (section 22.214.171.124).
The Array prototype object is itself an array; its [[Class]] is
"Array", and it has a length property (whose initial value is +0) and
the special internal [[Put]] method described in section 126.96.36.199.
On the other hand, Mark's proposal happens to match Firefox 3
(SpiderMonkey JS1.8) because Array.prototype is not "dense" -- it has
a bunch of named properties (to wit, the standard methods plus some
extensions). But this is just a bug.
I like that the proposal does not generalize to indexed properties in
any object. That seems better than obligating all implementations to
segregate named from indexed properties in their property-map
implementations. Array, Vector, other array-likes can opt in. ES4
should specify which ones do.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Es4-discuss