Since functions are given "global context" when not accessed as a property of an object [1], the following has the same quirk:
const foo = ({bar}) => {
bar(); // this === window
}
because it's just syntactic sugar for:
const foo = (x) => {
var bar = x.bar;
bar();
}
which seems slightly counter-intuitive to me since I now have to re-bind or forgo the sugar.
Is there a way to change this behaviour so that the context isn't changed (besides explicitly setting it via .apply/call/bind)? Are there any plans/proposals for standards to be implemented for it?