Allen Wirfs-Brock (2014-11-20T00:54:51.000Z)
On Nov 19, 2014, at 4:42 PM, Axel Rauschmayer <axel at rauschma.de> wrote:

>>> OK, I take it the following wasn’t viable?
>> 
>> that’s correct.  We wanted the initialization of a function like:
>>     export default function () {}
>> to be hoisted, just like:
>>     export function f() {};
> 
> I suspect that that will confuse people: they will expect an anonymous function to be an expression, not a declaration (even more so because the operand of `export default` is usually an expression). Does hoisting even matter if the function doesn’t have a name? Is it worth it to introduce a completely new construct (an anonymous function declaration) just for `export default`?
> 

It can make a difference to circular modules that reference each other’s default export.  Hosted function iinitialization occurs before anything in the module body is evaluated.  export default expression isn’t initialized at the point of the export declaration in the module body.

Allen
d at domenic.me (2014-12-05T19:10:56.965Z)
On Nov 19, 2014, at 4:42 PM, Axel Rauschmayer <axel at rauschma.de> wrote:

> I suspect that that will confuse people: they will expect an anonymous function to be an expression, not a declaration (even more so because the operand of `export default` is usually an expression). Does hoisting even matter if the function doesn’t have a name? Is it worth it to introduce a completely new construct (an anonymous function declaration) just for `export default`?
> 

It can make a difference to circular modules that reference each other’s default export.  Hosted function iinitialization occurs before anything in the module body is evaluated.  export default expression isn’t initialized at the point of the export declaration in the module body.