waldron.rick at gmail.com
Wed Jun 11 13:06:58 PDT 2014
On Wed, Jun 11, 2014 at 3:27 PM, Domenic Denicola <
domenic at domenicdenicola.com> wrote:
> From: Rick Waldron <waldron.rick at gmail.com>
> > 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
> > 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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss