On 3/31/2013 4:38 PM, David Bruant wrote:
Le 31/03/2013 21:17, Jeff Walden a écrit :
On 03/31/2013 11:02 AM, David Bruant wrote:
From the developer perspective, this doesn't really add anything
since it's already possible to throw from within the trap (and
that's probably more explicit and clearer than returning false).
That puts the onus on the trap to throw the correct kind of error,
right?
What do you mean by "correct"? It's already possible to throw any sort
of error from any trap; I'm not sure what's correct and what isn't in
that context.
The developer probably won't know what the correct error to throw is,
assuming their goal is to fail exactly like Object.preventExtensions
does. That is, the error that will be thrown from
Object.preventExtensions is only specified as a TypeError; different
engines can (and often do) have different error messages, and different
localizations will also have different messages. This is something a
developer can't hope to mimic.
That and throwing isn't always the correct action when the
preventExtension trap fail (Reflect.preventExtensions). Boolean is
definitely the right thing for this trap to return.
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss