ES6 spec: `export default` HoistableDeclaration

Axel Rauschmayer axel at rauschma.de
Wed Nov 19 13:59:07 PST 2014


>> * Do these grammar rules mean that you have to put anonymous function expressions in parentheses? Is that desirable (given that it’s a frequent use case)?
> 
> No, HoistableDeclaration[Default] includes FunctionDeclaration that lacks a BindingIdentifier.

OK, I take it the following wasn’t viable?

> `export default` [lookahead ≠ `function (` ] HoistableDeclaration  
> `export default` AssignmentExpression `;`

>> * If the purpose of the first rule is to enable default-exporting of declarations (= no semicolon) – shouldn’t classes be included?
> 
> It has nothing to do with semicolons. It's so a function that is a default export can also have a local name binding.

Ah, interesting and useful.

> We should also allow:
>    export default class Foo {};
> 
> where Foo is a module local binding.

Without the semicolon, though? The “operand” of `export default` is also a declaration, right?

> Please file a bug.

Will do, once I fully understand the issue.

-- 
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/20141119/a92fff51/attachment.html>


More information about the es-discuss mailing list