On Wed, Jun 11, 2014 at 3:27 PM, Domenic Denicola < [email protected]> wrote:
> From: Rick Waldron <[email protected]> > > > Or maybe that's not necessary? Is it preferable to just throw when > someone writes any of these: > > I think it is indeed preferable, as would happen when using any other > method (`this`-dependent function) without a `this`. > > > (Note that `Array.isArray` doesn't cease to work correctly when aliased) > > `Array.isArray` is not a method, but a function; it does not change > behavior depending on its `this` value. > I wasn't arguing that it was or wasn't, but I guess my point wasn't clear, so that's my mistake: most web developers won't know or care about the difference. > > > > > With the IsConstructor or IsCallable guard, these "just work"; without > any guard, they'll throw TypeError exceptions: "object is not a function" > or "undefined is not a function" (in strict mode). Neither of these errors > are very obvious. > > I disagree that this is not obvious. This is the same error you always get > when aliasing a method and trying to use it as a function. > > Of course this can all be fixed with .bind() or a "bind" operator, but > it just seems unfortunate to throw out something that's not harming the > spec in favor something that might be problematic in end user code. > > This is a bit of a slippery-slope argument; the end result is that every > method should have a default `this` value that it's "soft-bound" to, in > order to coddle the users who might get confused. > Fair enough, I give up, it's all yours to behead. Rick
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

