d at domenic.me (2015-01-05T20:24:35.132Z)
Kevin Smith wrote:
> I *think* the "default" binding in this case would still point to the
> function. I find this particular example completely baffling, to be
> honest.
This seems clear. As Dave said, he originally proposed an '=' in between
'default' and the *expression* to evaluate on the right. That design
remembrance should make clear that the default export is a function
expression (not function declaration) with 'a' the name only in the
scope of that function (either for recursion or as a downward funarg).
The 'default' binding won't be mutated via the final 'a = 2' statement,
so the default-exported value is still the result of evaluating the
function a(){} expression.
Kevin Smith wrote: > > ```js > export default function a() {} > a = 2; > ``` > > (This should be 2, right?) > > > I *think* the "default" binding in this case would still point to the > function. I find this particular example completely baffling, to be > honest. This seems clear. As Dave said, he originally proposed an '=' in between 'default' and the *expression* to evaluate on the right. That design remembrance should make clear that the default export is a function expression (not function declaration) with 'a' the name only in the scope of that function (either for recursion or as a downward funarg). The 'default' binding won't be mutated via the final 'a = 2' statement, so the default-exported value is still the result of evaluating the function a(){} expression. /be