Re: Proxies as prototypes

2014-11-23 Thread David Bruant

Le 23/11/2014 07:41, Axel Rauschmayer a écrit :
I’d expect the following code to log `GET bla`, but it currently 
doesn’t in Firefox. That’s because the Firefox implementation of 
proxies isn’t finished yet, right?
Yes. That would be https://bugzilla.mozilla.org/show_bug.cgi?id=914314 I 
think.


David
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: Proxies as prototypes

2014-11-23 Thread Till Schneidereit
On Sun, Nov 23, 2014 at 11:58 AM, David Bruant bruan...@gmail.com wrote:

  Le 23/11/2014 07:41, Axel Rauschmayer a écrit :

 I’d expect the following code to log `GET bla`, but it currently doesn’t
 in Firefox. That’s because the Firefox implementation of proxies isn’t
 finished yet, right?

 Yes. That would be https://bugzilla.mozilla.org/show_bug.cgi?id=914314 I
 think.


Correct, that's a known bug. Jason and Eric (CC'd) are working on fixes to
our MOP and Proxy implementation and I'd guess that this'll be fixed
soon-ish. As pointed out in the bug, you can work around it by also
implementing a [[Has]] handler.
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: Proxies as prototypes

2014-11-23 Thread Axel Rauschmayer
 On 23 Nov 2014, at 13:39, Till Schneidereit t...@tillschneidereit.net wrote:
 
 On Sun, Nov 23, 2014 at 11:58 AM, David Bruant bruan...@gmail.com 
 mailto:bruan...@gmail.com wrote:
 Le 23/11/2014 07:41, Axel Rauschmayer a écrit :
 I’d expect the following code to log `GET bla`, but it currently doesn’t in 
 Firefox. That’s because the Firefox implementation of proxies isn’t finished 
 yet, right?
 Yes. That would be https://bugzilla.mozilla.org/show_bug.cgi?id=914314 
 https://bugzilla.mozilla.org/show_bug.cgi?id=914314 I think.
 
 Correct, that's a known bug. Jason and Eric (CC'd) are working on fixes to 
 our MOP and Proxy implementation and I'd guess that this'll be fixed 
 soon-ish. As pointed out in the bug, you can work around it by also 
 implementing a [[Has]] handler.

Thanks David and Till!

I’ve only recently become fully aware of how much work that is, because proxies 
expose so much of the MOP (especially when it comes to getting and setting 
properties). With a proxy that logs when traps are triggered, you can see that 
auto-expansion in the Firefox console already triggers `ownKeys`, which is nice.

I’m looking forward to `Reflect` being available in Firefox: 
https://bugzilla.mozilla.org/show_bug.cgi?id=987514 
https://bugzilla.mozilla.org/show_bug.cgi?id=987514
As you probably know, this is a polyfill: 
https://github.com/tvcutsem/harmony-reflect

Axel

-- 
Dr. Axel Rauschmayer
a...@rauschma.de
rauschma.de



___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Proxies as prototypes

2014-11-22 Thread Axel Rauschmayer
I’d expect the following code to log `GET bla`, but it currently doesn’t in 
Firefox. That’s because the Firefox implementation of proxies isn’t finished 
yet, right?

```js
var proto = new Proxy({}, {
  get: function(target, propertyKey, receiver) {
console.log('GET '+propertyKey);
return target[propertyKey];
  }
});

var obj = Object.create(proto);
obj.bla;
```

-- 
Dr. Axel Rauschmayer
a...@rauschma.de
rauschma.de



___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss