Bound instance-function vending (was RE: Arrow binding)

Axel Rauschmayer axel at rauschma.de
Sun Apr 29 13:15:09 PDT 2012


Use case: error checks. For example: forEach could complain if it got both an arrow function and a thisValue. One could also complain if one expected a function with dynamic/unbound `this` and got a function with bound `this`, instead. To be extra strict, one could even complain when an unbound function is provided where a non-method function is expected (because either an arrow function should be used or a method’s `this` should be bound). All of these are things that you do as an API implementer, not necessarily as an API user.

Static checking would be even better, but then we would need a way to declare whether an argument is expected to have dynamic or lexical this.

Possibly 

On Apr 29, 2012, at 20:01 , Brendan Eich wrote:

> If so then there is no need for any isArrowFunction or isFunctionThatBindsOrIgnoresThis predicate.
> 
> /be
> 
> Axel Rauschmayer wrote:
>> With “rules”, I don’t mean rules in the sense of the language spec, but rather rules for teaching the language to newcomers.
> 

-- 
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120429/1cc08636/attachment.html>


More information about the es-discuss mailing list