On Wed, May 30, 2012 at 3:17 PM, David Herman <[email protected]> wrote:
> On May 30, 2012, at 2:18 PM, Mark S. Miller wrote:
>
>
>> However, there might be some utility (at least for debugging) in having a
>> Function.prototype.isThisBound method. It would return true for arrow
>> functions and functions created via Function.prototype.bind
>>
>
> I agree that such a predicate would be useful, but the useful predicate
> should also give "true" for functions that don't mention "this". Thus,
> "isThisBound" may not be the right name. What it really means is 'Can this
> function sense the "this" binding with which it is called?" If we call it
> "canSenseThis", then clearly we should also reverse the truth value.
>
>
> I don't understand what this predicate is supposed to test for. What does
> it return for
>
> function f(x, y) {
> if (false) {
> console.log(this.foo);
> }
> return x * y;
> }
>
> Can isBound be used to implement Function.prototype.halts? ;-P
>
>
Independent of name, I'm trying to test for "might sense this". Sorry for
confusing matters by saying "can". For your f function, I think the answer
should be that it might sense this, since it does mention "this" in its
body.
--
Cheers,
--MarkM
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss