arrows and a proposed softCall

Brendan Eich brendan at mozilla.org
Sat Jun 2 23:14:11 PDT 2012


Angus Croll wrote:
> To my mind (2) is the actual problem. To quote Yehuda "the proposed 
> semantics interfere with more intentional uses of `call` and `apply`."

The followups have made it clear to me there is no such interference in 
non-error cases. Users of call and apply who need to override |this| 
have as their contract that any funarg they take has dynamic |this|.

If you want to check to throw a nicer error, that's Mark's use case.

Otherwise there's no way to patch around a function that ignores |this| 
(or binds it -- but let's stick with ES3 here). Such a function passed 
as an argument to something like your mixin combinators that use .call 
is violating your library's contract.

So are you looking for an isBound predicate just to throw an error? I'm 
not saying that is a non-goal, I'm just asking to find out if there's 
some other, non-throwing recourse your code could use.

/be


More information about the es-discuss mailing list