Re: Proxies fail comparison operator

2017-03-30 Thread Allen Wirfs-Brock
For background on design goals of ES proxies see https://research.google.com/pubs/archive/40736.pdf  On Mar 30, 2017, 12:44 PM, at 12:44 PM, Michael Lewis wrote: >> >> I don't believe Proxies are designed to give you any encapsulation to >a >> user who also has a reference to the target object >

Re: Proxies fail comparison operator

2017-03-30 Thread Alex Vincent
You really don't *want* proxies to equal their underlying objects: proxies can show properties that the underlying object doesn't have, hide properties that the underlying object does have, alter the appearance of other proxies, etc. What you probably want is to never deal with the underlying obj

Re: Proxies fail comparison operator

2017-03-30 Thread Oriol _
> Isn't the purpose of the proxy to be exchanged with the original, without any > negative side effects? This is not possible. Proxies do not reflect internal slots, so for example, in a browser, ```js var obj = document; var proxy = new Proxy(obj, {}); Node.prototype.contains.call(obj, obj); /

Re: Proxies fail comparison operator

2017-03-30 Thread Michael Lewis
> > I don't believe Proxies are designed to give you any encapsulation to a > user who also has a reference to the target object > So the Proxy wasn't designed to proxy real objects that operate with real code? `myRealFunction(obj)` <---> `myRealFunction(proxy)` This could be incredibly useful.

Re: Proxies fail comparison operator

2017-03-30 Thread Jordan Harband
I don't believe Proxies are designed to give you any encapsulation to a user who also has a reference to the target object - you'd have to never provide the reference to the target object in the first place. On Thu, Mar 30, 2017 at 11:50 AM, Michael Lewis wrote: > Hello community, > > The proxy

Proxies fail comparison operator

2017-03-30 Thread Michael Lewis
Hello community, The proxy is almost an identical to the underlying object, but it* fails a comparison check with the underlying object.* This means that if anyone gets a reference to the underlying object before it is proxied, then we have a problem. For example: var obj = {}; var proxy = new

Re: Proposal: Expose offsets for capturing groups in regular expression matches

2017-03-30 Thread Sebastian Zartner
I've filed issue https://github.com/tc39/proposal-regexp-named-groups/issues/21 to start the discussion there. Sebastian On 30 March 2017 at 12:25, Daniel Ehrenberg wrote: > I've been trying to organize feedback to the named captures proposal in > bugs on the repository in GitHub at https://git

Re: Strawman: Complete array and object destructuring

2017-03-30 Thread Isiah Meadows
@implementors Could you tell me whether I'm thinking on the right track for implementing inner rest parameters? I know you all had serious concerns over optimization of inner rest parameters initially (hence why it didn't make it into ES2015), so I was wondering if this addressed some of them, and

Re: A WeakMap where values (not keys) are weak references?

2017-03-30 Thread Michael Kriegel
BTW are the security concerns mentioned by Erik Arvidsson in this thread (http://mozilla.6506.n7.nabble.com/What-is-the-status-of-Weak-References-tp271746p271750.html) still present? Wouldn't a solution be, to make the weak references of one actor dispose as soon as this actor has no strong re

Re: A WeakMap where values (not keys) are weak references?

2017-03-30 Thread Michael Kriegel
Totally agree. WeakRef is what we want and WeakValueMap is what I want to build with it. Sugar would be if the standard provides "an out-of-the-box WeakValueMap *as well*". Automatic removal of entries after they became obsolete would be necessary - be it integrated or via a callback mechanism

Re: A WeakMap where values (not keys) are weak references?

2017-03-30 Thread T.J. Crowder
Right -- but it's really weak references you're after, right? Because with weak references, a Map can be a WeakValueMap, but other structures are also possible. With that proposal's `executor` feature, the map can even be proactive removing entries for objects that have become only weakly reachable

Re: Proposal: Expose offsets for capturing groups in regular expression matches

2017-03-30 Thread Sebastian Zartner
Hi, and sorry for the response delay! On 24 March 2017 at 01:47, Jordan Harband wrote: > Adding a property to the match result is indeed tricky. > Why? The match result already has the properties index and input . > Not su

Re: A WeakMap where values (not keys) are weak references?

2017-03-30 Thread Michael Kriegel
I am also still very interested in Weak references / a weak map, where the values are held weakly. Here is my example: I want to easily build caches, which lose their values, when there are no other references to them. Example pseudo code (assuming server request answers synchronously for simpl