> >>a function shouldn’t work radically (and silently!) different depending on 
> >>how it is invoked
> 
> every current JS function behaves exactly this way :-)

`this` when not invoking a function as a method:
1. Bearable: this === undefined
2. Nasty: this === window
3. Very nasty: lexical this

> I'm painfully aware that I sound like a broken record on this, but 
> introducing a hard-bound function option while continuing to suport 
> dynamic-bound functions everywhere else is not going to simplify anything.

The point is that dynamic-bound functions will mostly go away in ES.next. There 
will mainly be methods and arrow functions. With super-references, methods 
become more than functions with dynamic this, anyway!

> Another function should not need to know how its function arguments were 
> created in order to work properly - thats a terrible anti-functional 
> anti-pattern!

Counter-question: Isn’t it clear when you create a function whether it is going 
to be a non-method function or a method? What is the use case for a non-method 
function with dynamic this?

Sometimes you might want to pass a method as a callback, but then you need to 
convert it to a non-method function, anyway (e.g. via bind()).

-- 
Dr. Axel Rauschmayer
[email protected]

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

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to