ES6 spec: `export default` HoistableDeclaration

Axel Rauschmayer axel at rauschma.de
Wed Nov 19 16:42:25 PST 2014


>> 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`?

-- 
Dr. Axel Rauschmayer
axel at rauschma.de
rauschma.de



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20141120/b9d3ebae/attachment.html>


More information about the es-discuss mailing list