Re: [[OwnPropertyKeys]] key ordering

2014-04-22 Thread Boris Zbarsky
On 4/19/14, 4:38 PM, Charles Kendrick wrote: However, for the record, I continue to think that special treatment of numeric keys is a really bad design for property order for Objects (for Arrays, it's fine). In practice people use plain objects as arrays (i.e. setting indexed properties on

Re: [[OwnPropertyKeys]] key ordering

2014-04-22 Thread Andreas Rossberg
On 19 April 2014 20:14, Allen Wirfs-Brock al...@wirfs-brock.com wrote: I'm in the middle of updating the spec. of [[OwnPropertyKeys]] to returns an Array rather than an Iterator. While doing this I realized that because [[OwnPropertyKeys]] is essentially a new MOP level operation we have the

Re: [[OwnPropertyKeys]] key ordering

2014-04-22 Thread Allen Wirfs-Brock
On Apr 22, 2014, at 12:02 AM, Andreas Rossberg wrote: On 19 April 2014 20:14, Allen Wirfs-Brock al...@wirfs-brock.com wrote: The ordering I propose is: 1) All array index property keys, in ascending array index numeric order. Followed by: 2) All other string property keys, in property

Re: [[OwnPropertyKeys]] key ordering

2014-04-22 Thread Andreas Rossberg
On 22 April 2014 16:52, Allen Wirfs-Brock al...@wirfs-brock.com wrote: On Apr 22, 2014, at 12:02 AM, Andreas Rossberg wrote: On 19 April 2014 20:14, Allen Wirfs-Brock al...@wirfs-brock.com wrote: The ordering I propose is: 1) All array index property keys, in ascending array index numeric

Re: [[OwnPropertyKeys]] key ordering

2014-04-22 Thread Allen Wirfs-Brock
On Apr 22, 2014, at 8:45 AM, Andreas Rossberg wrote: On 22 April 2014 16:52, Allen Wirfs-Brock al...@wirfs-brock.com wrote: On Apr 22, 2014, at 12:02 AM, Andreas Rossberg wrote: On 19 April 2014 20:14, Allen Wirfs-Brock al...@wirfs-brock.com wrote: The ordering I propose is: 1) All

Object.mixin rather than Object.getOwnPropertyDescriptors

2014-04-22 Thread Claude Pache
Hi, There has been request to add `Object.getOwnPropertyDescriptors` (plural) to the standard. Reviewing use cases presented in thread [1] or in older thread [2], it seems to me that all of them boil down to copy all own properties of one object to another, e.g.,

Re: Object.mixin rather than Object.getOwnPropertyDescriptors

2014-04-22 Thread Andrea Giammarchi
while I think that Object.create( Object.getPrototypeOf(originalObject), Object.getOwnPropertyDescriptors(originalObject)) looks semantically better than Object.mixin( Object.create(Object.getPrototypeOf(originalObject)), originalObject) I also think that Object.mixin could be used for

Re: [[OwnPropertyKeys]] key ordering

2014-04-22 Thread Mark S. Miller
I would prefer that this implementation limit be treated even more like the stack limit; say by throwing an error rather than silently adding a 1+2^24 property that breaks the contract. Any reason not to throw an error on this? That said, I agree that this should be an implementation limit rather

Re: Object.mixin rather than Object.getOwnPropertyDescriptors

2014-04-22 Thread Claude Pache
Le 22 avr. 2014 à 19:58, Andrea Giammarchi andrea.giammar...@gmail.com a écrit : while I think that Object.create( Object.getPrototypeOf(originalObject), Object.getOwnPropertyDescriptors(originalObject) ) looks semantically better than Object.mixin(

Re: Object.mixin rather than Object.getOwnPropertyDescriptors

2014-04-22 Thread Andrea Giammarchi
IMO every time you use `getOwnPropertyDescriptor` over a `getOwnPropertyNames` you are asking for a `getOwnPropertyDescriptors` implementation, that's the use case. Twisting your question, do you have any use case for `getOwnPropertyNames` that won't require later on `getOwnPropertyDescriptor` ?

Re: Object.mixin rather than Object.getOwnPropertyDescriptors

2014-04-22 Thread Claude Pache
Le 22 avr. 2014 à 21:05, Andrea Giammarchi andrea.giammar...@gmail.com a écrit : IMO every time you use `getOwnPropertyDescriptor` over a `getOwnPropertyNames` you are asking for a `getOwnPropertyDescriptors` implementation, that's the use case. And in these cases, again, are the

Re: Object.mixin rather than Object.getOwnPropertyDescriptors

2014-04-22 Thread Andrea Giammarchi
`getOwnPropertyDescriptors` retrieves at once everything that both ` getOwnProperty{Names,Symbol}` plus `getOwnPropertyDescriptor` per each name or symbol would .. we have few shortcut/utilities in ES, why you see this so useless? Even Array#forEach can be decomposed in a for loop ... how about

Re: Object.mixin rather than Object.getOwnPropertyDescriptors

2014-04-22 Thread Rick Waldron
On Tue, Apr 22, 2014 at 1:27 PM, Claude Pache claude.pa...@gmail.comwrote: Hi, There has been request to add `Object.getOwnPropertyDescriptors` (plural) to the standard. Reviewing use cases presented in thread [1] or in older thread [2], it seems to me that all of them boil down to copy all