Re: Object.getOwnPropertyDescriptors still at stage 0

2016-05-25 Thread Jordan Harband
Closing the loop on this: this proposal is now stage 4, and will be included in ES 2017. https://github.com/tc39/ecma262/pull/582 Polyfill: https://www.npmjs.com/package/object.getownpropertydescriptors On Wed, Jan 20, 2016 at 9:26 PM, Jordan Harband <ljh...@gmail.com> wrote: >

RE: Object.getOwnPropertyDescriptors still at stage 0

2016-01-20 Thread Domenic Denicola
Giammarchi Sent: Wednesday, January 20, 2016 14:50 To: Mathias Bynens <mathi...@opera.com> Cc: es-discuss@mozilla.org Subject: Re: Object.getOwnPropertyDescriptors still at stage 0 Dear all, the current proposal is here https://github.com/WebReflection/Object.getOwnPropertyDescr

Re: Object.getOwnPropertyDescriptors still at stage 0

2016-01-20 Thread Andrea Giammarchi
Dear all, the current proposal is here https://github.com/WebReflection/Object.getOwnPropertyDescriptors#objectgetownpropertydescriptors-proposal It has been mostly copied, as suggested, from https://github.com/tc39/Array.prototype.includes It has a reference implemntation: https://github.com

Re: Object.getOwnPropertyDescriptors still at stage 0

2016-01-20 Thread Andrea Giammarchi
ght not be necessary.) > > > > *From:* es-discuss [mailto:es-discuss-boun...@mozilla.org] *On Behalf Of > *Andrea > Giammarchi > *Sent:* Wednesday, January 20, 2016 14:50 > *To:* Mathias Bynens <mathi...@opera.com> > *Cc:* es-discuss@mozilla.org > *S

Re: Object.getOwnPropertyDescriptors still at stage 0

2016-01-20 Thread Jordan Harband
ers, and proxies with throwing and inconsistent getOwnProperty and >> ownPropertyKeys traps. (The proxies cases might not be necessary.) >> >> >> >> *From:* es-discuss [mailto:es-discuss-boun...@mozilla.org] *On Behalf Of >> *Andrea Giammarchi >> *Sent:*

Object.getOwnPropertyDescriptors still at stage 0

2016-01-18 Thread Andrea Giammarchi
Accordingly with this ecma262 stage 0 summary https://github.com/tc39/ecma262/blob/master/stage0.md the (quite long time ago) discussed `Object.getOwnPropertyDescriptors` https://gist.github.com/WebReflection/9353781 hasn't move a bit from there. However, there are already use cases https

Re: Object.getOwnPropertyDescriptors still at stage 0

2016-01-18 Thread Mathias Bynens
On Mon, Jan 18, 2016 at 6:50 PM, Andrea Giammarchi <andrea.giammar...@gmail.com> wrote: > Accordingly with this ecma262 stage 0 summary > https://github.com/tc39/ecma262/blob/master/stage0.md the (quite long time > ago) discussed `Object.getOwnPropertyDescriptors` > https

Re: Object.getOwnPropertyDescriptors still at stage 0

2016-01-18 Thread Andrea Giammarchi
iammarchi > <andrea.giammar...@gmail.com> wrote: > > Accordingly with this ecma262 stage 0 summary > > https://github.com/tc39/ecma262/blob/master/stage0.md the (quite long > time > > ago) discussed `Object.getOwnPropertyDescriptors` > > https://gist.github.com

Re: Object.getOwnPropertyDescriptors still at stage 0

2016-01-18 Thread Mathias Bynens
On Mon, Jan 18, 2016 at 8:27 PM, Andrea Giammarchi wrote: > Do you (or anyone else) know if that should be filed as a PR to tc39/ecma262 > or if it should just be a repository eventually posted in here? It should be a repository that can eventually move to the tc39

Re: Object.mixin rather than Object.getOwnPropertyDescriptors

2014-04-30 Thread Marcus Stade
I have a use case for `Object.getOwnPropertyDescriptors` – it may or may not be to your liking, but I have one. I'm currently implementing a library to help with employing more pure functional programming techniques in JavaScript environments. This includes such things as (mostly) forcing

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., Object.defineProperties

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

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( Object.create

Re: Object.mixin rather than Object.getOwnPropertyDescriptors

2014-04-22 Thread Andrea Giammarchi
` ? On Tue, Apr 22, 2014 at 11:59 AM, Claude Pache claude.pa...@gmail.comwrote: 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

Re: Object.mixin rather than Object.getOwnPropertyDescriptors

2014-04-22 Thread Claude Pache
,Symbol}` dichotomy of ES6, but that's another question.) On the other hand `Object.getOwnPropertyDescriptors` and `Object.mixin` are complex methods. —Claude On Tue, Apr 22, 2014 at 11:59 AM, Claude Pache claude.pa...@gmail.com wrote: Le 22 avr. 2014 à 19:58, Andrea Giammarchi andrea.giammar

Re: Object.mixin rather than Object.getOwnPropertyDescriptors

2014-04-22 Thread Andrea Giammarchi
functionalities. (Not sure about the `getOwnProperty{Names,Symbol}` dichotomy of ES6, but that's another question.) On the other hand `Object.getOwnPropertyDescriptors` and `Object.mixin` are complex methods. —Claude On Tue, Apr 22, 2014 at 11:59 AM, Claude Pache claude.pa...@gmail.com wrote

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

Re: Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-07 Thread Tom Van Cutsem
2014-03-07 0:51 GMT+01:00 C. Scott Ananian ecmascr...@cscott.net: On Thu, Mar 6, 2014 at 6:31 PM, André Bargull andre.barg...@udo.edu wrote: On 3/6/2014 11:35 PM, Andrea Giammarchi wrote: The proposed [[GetOwnPropertyNames]] internal method is supposed to be a more restrictive version of

Re: Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-07 Thread C. Scott Ananian
I was also a bit puzzled by the iterator return value. I expected that it would handle mutation (adding new properties) during traveral the way that the `Map` and `Set` iterators do. I was surprised to see that all the users turned the iterator into an array; none seemed to handle concurrent

Re: Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-07 Thread Brendan Eich
Tom Van Cutsem wrote: Given that most of the functions that use [[OwnPropertyKeys]] need to either construct an array anyway, or want reliable results, I wonder whether we shouldn't just change [[OwnPropertyKeys]] to include the checks and return an array instead of an iterable. That way we

Re: Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-06 Thread C. Scott Ananian
, 2014 at 1:39 PM, Tom Van Cutsem tomvc...@gmail.com wrote: Object.getOwnPropertyDescriptors(proxy) would trigger the getOwnPropertyNames trap, followed by calls to the getOwnPropertyDescriptor trap for each individual property. [[OwnPropertyKeys]], `ownKeys` trap. Yes, according

Re: Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-06 Thread Andrea Giammarchi
-05 20:11 GMT+01:00 C. Scott Ananian ecmascr...@cscott.net: On Wed, Mar 5, 2014 at 1:39 PM, Tom Van Cutsem tomvc...@gmail.com wrote: Object.getOwnPropertyDescriptors(proxy) would trigger the getOwnPropertyNames trap, followed by calls to the getOwnPropertyDescriptor trap for each

Re: Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-06 Thread André Bargull
tomvc.be at gmail.com https://mail.mozilla.org/listinfo/es-discuss // wrote: //Object.getOwnPropertyDescriptors(proxy) would trigger the //getOwnPropertyNames trap, followed by calls to the //getOwnPropertyDescriptor //trap for each individual property. // // [[OwnPropertyKeys

Re: Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-06 Thread Brendan Eich
André Bargull mailto:andre.barg...@udo.edu March 6, 2014 at 1:21 PM I would rephrase into this: if you need a getOwnPropertyNames trap, you might need for consistency a getOwnPropertySymbols independently from getOwnPropertyDescriptors since these methods are already available. While it

Re: Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-06 Thread Andrea Giammarchi
https://mail.mozilla.org/listinfo/es-discuss * * wrote: ** Object.getOwnPropertyDescriptors(proxy) would trigger the ** getOwnPropertyNames trap, followed by calls to the ** getOwnPropertyDescriptor ** trap for each individual property. ** ** [[OwnPropertyKeys]], `ownKeys` trap

Re: Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-06 Thread Andrea Giammarchi
at cscott.net https://mail.mozilla.org/listinfo/es-discuss: ** ** On Wed, Mar 5, 2014 at 1:39 PM, Tom Van Cutsem tomvc.be at gmail.com https://mail.mozilla.org/listinfo/es-discuss * * wrote: ** Object.getOwnPropertyDescriptors(proxy) would trigger the ** getOwnPropertyNames trap, followed

Re: Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-06 Thread André Bargull
On 3/6/2014 10:24 PM, Brendan Eich wrote: André Bargull mailto:andre.barg...@udo.edu March 6, 2014 at 1:21 PM I would rephrase into this: if you need a getOwnPropertyNames trap, you might need for consistency a getOwnPropertySymbols independently from getOwnPropertyDescriptors since these

Re: Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-06 Thread André Bargull
/listinfo/es-discuss: // // On Wed, Mar 5, 2014 at 1:39 PM, Tom Van Cutsem tomvc.be at gmail.com https://mail.mozilla.org/listinfo/es-discuss / /wrote: // Object.getOwnPropertyDescriptors(proxy) would trigger the // getOwnPropertyNames trap, followed

Re: Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-06 Thread Andrea Giammarchi
/ /wrote: // Object.getOwnPropertyDescriptors(proxy) would trigger the // getOwnPropertyNames trap, followed by calls to the // getOwnPropertyDescriptor // trap for each individual property. // // [[OwnPropertyKeys]], `ownKeys` trap

Re: Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-06 Thread C. Scott Ananian
On Thu, Mar 6, 2014 at 6:31 PM, André Bargull andre.barg...@udo.edu wrote: On 3/6/2014 11:35 PM, Andrea Giammarchi wrote: The proposed [[GetOwnPropertyNames]] internal method is supposed to be a more restrictive version of [[OwnPropertyKeys]] to ensure Proxy objects don't lie about their

Re: Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-05 Thread Tom Van Cutsem
2014-03-05 20:11 GMT+01:00 C. Scott Ananian ecmascr...@cscott.net: On Wed, Mar 5, 2014 at 1:39 PM, Tom Van Cutsem tomvc...@gmail.com wrote: Object.getOwnPropertyDescriptors(proxy) would trigger the getOwnPropertyNames trap, followed by calls to the getOwnPropertyDescriptor trap for each

RE: Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-04 Thread Andrea Giammarchi
-discuss@mozilla.org list es-discuss@mozilla.org Subject: Re: Object.getOwnPropertyDescriptors(O) ? // plural Have you filed a bugzilla ticket for this? That seems the best way to ensure it will get discussed at the next TC39 meeting and resolved one way or the other. --scott On Mar 3, 2014 8:44 PM

Re: Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-04 Thread Rick Waldron
Windows Phone -- From: C. Scott Ananian csc...@cscott.net Sent: 3/4/2014 6:16 To: Andrea Giammarchi andrea.giammar...@gmail.com Cc: es-discuss@mozilla.org list es-discuss@mozilla.org Subject: Re: Object.getOwnPropertyDescriptors(O) ? // plural Have you filed

Re: Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-04 Thread Rick Waldron
/2014 6:16 To: Andrea Giammarchi andrea.giammar...@gmail.com Cc: es-discuss@mozilla.org list es-discuss@mozilla.org Subject: Re: Object.getOwnPropertyDescriptors(O) ? // plural Have you filed a bugzilla ticket for this? That seems the best way to ensure it will get discussed at the next TC39

Re: Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-04 Thread Andrea Giammarchi
-- From: C. Scott Ananian csc...@cscott.net Sent: 3/4/2014 6:16 To: Andrea Giammarchi andrea.giammar...@gmail.com Cc: es-discuss@mozilla.org list es-discuss@mozilla.org Subject: Re: Object.getOwnPropertyDescriptors(O) ? // plural Have you filed a bugzilla ticket for this? That seems

Re: Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-04 Thread Rick Waldron
On Tue, Mar 4, 2014 at 12:48 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: yes, because `Object.getOwnPropertyDescriptor(O, k)` accepts both `propertyName` and `Symbol` as second argument. The plural, and to be consistent with the shallowCopy example, should return a list of both.

Re: Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-04 Thread Allen Wirfs-Brock
On Mar 4, 2014, at 9:34 AM, Rick Waldron wrote: On Tue, Mar 4, 2014 at 12:30 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: Apparently this triggered an @rwaldron which seems to be super-effective In agenda for April's meeting. Yep:

Re: Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-04 Thread Andrea Giammarchi
` of descriptors the proposed plural `Object.getOwnPropertyDescriptors(O)` should return is a collection that includes descriptors for both `properties` and `Symbols` I hope this makes sense. Thanks again Rick for, at least, trying and helping out with this. Cheers On Tue, Mar 4, 2014 at 9:48 AM, Andrea

Re: Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-04 Thread Rick Waldron
On Tue, Mar 4, 2014 at 1:03 PM, Allen Wirfs-Brock al...@wirfs-brock.comwrote: On Mar 4, 2014, at 9:34 AM, Rick Waldron wrote: On Tue, Mar 4, 2014 at 12:30 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: Apparently this triggered an @rwaldron which seems to be super-effective

Re: Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-04 Thread Andrea Giammarchi
this boilerplate is error prone and prolix plus it cannot be optimized in core so it's also very slow. With the introduction of classes, Symbols, and all ES6 new entries, I feel like the `for(var key in object)` loop is dead but developers have no way to clone objects in the right way and in one

Re: Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-04 Thread Allen Wirfs-Brock
On Mar 4, 2014, at 10:17 AM, Rick Waldron wrote: I like this cloning idiom, but I don't see why we would consider this for ES6, it isn't something that is critical or can't be implemented via ES code. It would be much more appropriate to queue it up for the 2015 train. ES6: let's

Re: Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-04 Thread Andrea Giammarchi
Allen, as developer, being unable to `shallow-copy` in JavaScript for other *N* years is actually critical. Luckily it's not so difficult to polyfill but if you have Rick presenting [something like this]( https://gist.github.com/WebReflection/9353781#objectgetownpropertydescriptorso) I really

Re: Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-04 Thread Rick Waldron
On Tue, Mar 4, 2014 at 2:40 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: Allen, as developer, being unable to `shallow-copy` in JavaScript for other *N* years is actually critical. Luckily it's not so difficult to polyfill but if you have Rick presenting [something like this](

Re: Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-04 Thread Andrea Giammarchi
, Object.getOwnPropertyDescriptors(source) ); ``` So, in order of priority or what is needed the most, I think with `Object.getOwnPropertyDescriptors(O)` we can solve more than `Object.assign(target, source)` but bear in mind I am not pushing back the latter one anyhow. IMO this proposal is just very

Re: Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-04 Thread Claude Pache
Object.defineProperties( target, Object.getOwnPropertyDescriptors(source) ); ``` No. `Object.assign` (1) uses the semantics of the assignment operator `=` (for example, it makes a difference in case of setters), and (2) copies only enumerable properties. Did you think about `Object.mixin

Re: Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-04 Thread Andrea Giammarchi
You are right, I've realized it after posting ... `Object.assign(target, source)` via `Get` and `Put` is basically the equivalent of a classic `for/in` with `hasOwnProperty` check ... well, once again, in ES6 `Object.getOwnPropertyDescriptors(O)` seems to be a solution for other cases too (shallow

Re: Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-03 Thread Andrea Giammarchi
will be definable through descriptors ... all this VS ```javascript var shallowCopy = Object.create( Object.getPrototypeOf(originalObject), Object.getOwnPropertyDescriptors(originalObject) ); ``` which I believe is a win. Thanks On Sun, Mar 2, 2014 at 5:01 PM, Andrea Giammarchi

Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-02 Thread Andrea Giammarchi
= Object.create( Object.getPrototypeOf(originalObject), Object.getOwnPropertyDescriptors(originalObject) ); ``` Today what we have to do this instead: ```javascript var shallowCopy = Object.create( Object.getPrototypeOf(originalObject), Object.getOwnPropertyNames(originalObject).reduce

Re: Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-02 Thread Brandon Benvie
), Object.getOwnPropertyDescriptors(originalObject) ); ``` Today what we have to do this instead: ```javascript var shallowCopy = Object.create( Object.getPrototypeOf(originalObject), Object.getOwnPropertyNames(originalObject).reduce( function (descriptors, name) { descriptors[name

Re: Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-02 Thread Andrea Giammarchi
```javascript var shallowCopy = Object.create( Object.getPrototypeOf(originalObject), Object.getOwnPropertyDescriptors(originalObject) ); ``` which I believe is a win. Thanks On Sun, Mar 2, 2014 at 5:01 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: I wonder if by any chance

Re: Object.getOwnPropertyDescriptors(O) ? // plural

2014-03-02 Thread Andrea Giammarchi
( Object.getPrototypeOf(originalObject), Object.getOwnPropertyDescriptors(originalObject) ); ``` which I believe is a win. Thanks On Sun, Mar 2, 2014 at 5:01 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: I wonder if by any chance this could sneak into ES6 ... we have only

Object.getOwnPropertyDescriptors

2011-11-11 Thread Xavier MONTILLET
Hi, I think adding Object.getOwnPropertyDescriptors would be great. It could be implemented like this: Object.getOwnPropertyDescriptors = function ( object ) { var propertiesDescriptor = { }; Object.getOwnPropertyNames( object ).forEach( function ( key ) { propertiesDescriptor

Re: Object.getOwnPropertyDescriptors

2011-11-11 Thread Axel Rauschmayer
It has already been proposed, look here: http://wiki.ecmascript.org/doku.php?id=strawman:extended_object_api On Nov 11, 2011, at 20:30 , Xavier MONTILLET wrote: Hi, I think adding Object.getOwnPropertyDescriptors would be great. It could be implemented like