Re. the cryptic error messages when triggering missing derived or fundamental traps: is there any reason why an engine can't create understandable error messages for these cases?
An error message such as "non-callable defineProperty trap on proxy" would more readily identify the problem than "defineProperty is not a function". 2011/1/24 Tom Van Cutsem <tomvc...@gmail.com> > I think there would be a couple of differences between a noop-handler and a > forwarder-to-an-empty-object. > > For one: defining a property on a forwarder-to-an-empty-object would > actually define the property on the empty object. AIUI, the noop handler > would silently absorb the assignment. Fixing would also be very different. I > think forwarding-to-an-empty-object would probably lead to the most > intuitive behavior. toString() would also work as expected when forwarding > to an empty object. > > One could define a helper function along the lines of: > > Proxy.createEmptyHandler = function(proto) { > proto = proto || null; // maybe the default should be Object.prototype so > that toString() works as expected > return new Proxy.Handler(Object.create(proto)); > } > > I'm not sure whether this is sufficiently convenient to be worth > standardizing though. > > 2011/1/22 Dave Herman <dher...@mozilla.com> > > Not sure; I'll think about it. Though abstracting >> Proxy.Handler(Object.create(null, {})) might in fact be a worthwhile >> convenience. >> >> Dave >> >> "Mark S. Miller" <erig...@google.com> wrote: >> >> >On Fri, Jan 21, 2011 at 2:45 PM, David Herman <dher...@mozilla.com> >> >wrote: >> > >> >> > Should we have a no-op or "sink" standard handler too? >> >> >> >> I think so, yes. Especially since you can use that to build one up >> >that >> >> implements just the other traps you want to implement, and let the >> >others >> >> "fail soft." >> >> >> > >> >How would it be different from >> > >> > new Proxy.Handler(Object.create(null, {})) >> > >> >? >> > >> >Or, depending on how soft you want to fail >> > >> > new Proxy.Handler(null) >> > >> >? >> > >> >If there is a useful difference, I have no objection. >> > >> > >> >> >> >> Dave >> >> >> >> >> > >> > >> >-- >> > Cheers, >> > --MarkM >> >> -- >> Sent from my Android phone with K-9 Mail. Please excuse my brevity. >> _______________________________________________ >> es-discuss mailing list >> es-discuss@mozilla.org >> https://mail.mozilla.org/listinfo/es-discuss >> > >
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss