direct_proxies "problem"

François REMY francois.remy.dev at outlook.com
Tue Jan 8 13:24:21 PST 2013


It's certainly possible. I think the point is that we would like to get this specced instead? Or at least, can we get the TC39-committee do find an (informative) agreement on the issue if it doesn't fit in a spec?

________________________________
> Date: Tue, 8 Jan 2013 16:18:17 -0500 
> Subject: Re: direct_proxies "problem" 
> From: brandon at brandonbenvie.com 
> To: andrea.giammarchi at gmail.com 
> CC: francois.remy.dev at outlook.com; es-discuss at mozilla.org 
> 
> Since proxies always have a target, it would be simple enough for the 
> DOM internally to use the proxy target. As to whether that's going to 
> happen, I guess that would be up to implementers. 
> 
> 
> On Tue, Jan 8, 2013 at 4:15 PM, Andrea Giammarchi 
> <andrea.giammarchi at gmail.com<mailto:andrea.giammarchi at gmail.com>> 
> wrote: 
> never even tried that since cloneNode() has been good enough but 
> Proxies are more powerful than "just inheritance" so, as it is now, we 
> are trapped for the DOM while Object.observe(), if I remember 
> correctly, was reacting/working with DOM too plus makes object somehow 
> "proxified" or better "observed". 
> 
> I assume we have no solutions now and no solution is discussed, am I correct? 
> 
> thanks 
> 
> 
> On Tue, Jan 8, 2013 at 12:53 PM, François REMY 
> <francois.remy.dev at outlook.com<mailto:francois.remy.dev at outlook.com>> 
> wrote: 
> This is a known problem called Object identity. We already have this 
> problem today with Object.create(document.createElement("p")) which is 
> an "instanceof HTMLElement" but is invalid for any DOM purpose. 
> 
> However, if you take the same P element and set its __proto__ to null, 
> it will still be a valid P element for DOM purposes even though it's no 
> an "instanceof HTMLElement" anymore. I don't know is this behavior is 
> specced anywhere, but this is how it works. 
> 
> Maybe it would be great to have a way to "confer" the object identify 
> to another object, and it could be useful for polyfill use cases. Until 
> now, it's not possible to create an object whose native object identity 
> is not "neutral". Proxies don't escape to this rule... 
> 
> 
> ________________________________ 
> > Date: Tue, 8 Jan 2013 12:40:00 -0800 
> > Subject: direct_proxies "problem" 
> > From: andrea.giammarchi at gmail.com<mailto:andrea.giammarchi at gmail.com> 
> > To: es-discuss at mozilla.org<mailto:es-discuss at mozilla.org> 
> > 
> > So, I am playing with FF 18 and I have this behavior: 
> > 
> > var a = new Proxy([], {}); 
> > console.log(a instanceof Array); // true 
> > console.log(Array.isArray(a)); // true 
> > console.log({}.toString.call(a));// [object Array] 
> > 
> > Function.apply(null, a); // anonymous() 
> > 
> > Cool uh? there's no way to tell that a is not actually an array but 
> rather a proxy: awesome!!! 
> > 
> > Now I go in that dark place called DOM: 
> > 
> > var n = new Proxy(document.createElement("p"), {}); 
> > console.log(n instanceof HTMLElement);// true 
> > console.log({}.toString.call(n)); // true 
> > document.body.appendChild(n); 
> > // Error: Could not convert JavaScript argument arg 0 
> [nsIDOMHTMLBodyElement.appendChild] 
> > 
> > Is this meant? 'cause it looks lik ewe have half power here and once 
> again inconsistencies ... thanks for explaining me this. 
> > 
> > 
> > br 
> > 
> > _______________________________________________ es-discuss mailing list 
> > es-discuss at mozilla.org<mailto:es-discuss at mozilla.org> 
> https://mail.mozilla.org/listinfo/es-discuss 
> 
> 
> _______________________________________________ 
> es-discuss mailing list 
> es-discuss at mozilla.org<mailto:es-discuss at mozilla.org> 
> https://mail.mozilla.org/listinfo/es-discuss 
> 
> 		 	   		  


More information about the es-discuss mailing list