once again, in node.js `this` is the exported module. I think we should not
make it `undefined` neither a `global` pointer ... in node.js `this` in
modules is never global except when you launch the console so only in the
main, where we are already consistently good on browsers since `this` is
the global there (script on a page, not modules)

Do we really want to break interoperability with node.js when it comes to
`this` inside modules which is a keyword that could not even be reassigned
to nothing and/or monkey patched ?

As tweeted earlier today: I can already smell the next stinking module
feature detection `if (this) console.log("you are in nodejs") else
alert("WTF browser module")`

Best Regards



On Mon, Jun 9, 2014 at 4:14 PM, Kevin Smith <zenpars...@gmail.com> wrote:

>
> What is an arrow function bound to in a module?
>>
>> ```js
>> export var a = () => this;
>> ```
>>
>
> As with all arrow functions, `this` is lexically bound, so it will bind to
> whatever `this` is bound to within the module.  Which is kinda the question
> at hand.
>
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to