Domenic Denicola domenic at
Wed Jun 11 12:27:12 PDT 2014

From: Rick Waldron <waldron.rick at>

> 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.

> 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.

More information about the es-discuss mailing list