Why is "export default var a = 1;" invalid syntax?

Allen Wirfs-Brock allen at wirfs-brock.com
Tue Dec 16 08:11:08 PST 2014


On Dec 16, 2014, at 12:07 AM, Glen Huang wrote:

> A little tweak:
> 
> Syntax
> 	export default var VariableDeclaration;
> 
> ExportEntries
> Let names be the BoundNames of VariableDeclaration.
> Let localName be the sole element of names.
> Return a new List containing the Record {[[ModuleRequest]]: null, [[ImportName]]: null, [[LocalName]]: localName, [[ExportName]]: "default"}

Still not enough, you'd also have to make sure that things like the following are rejected as syntax errors:

   export default var {a,b,c} = obj;  //their can only be one binding per module that is exported as 'default'

Regardless, ES6 is now frozen except for significant bug fixes.  Extensions like this can be considered for future for subsequent editions.

BTW, I should have also pointed you to https://people.mozilla.org/%7Ejorendorff/es6-draft.html#sec-static-and-runtme-semantics-module-records and in particular, the last table in that section.

Allen


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


More information about the es-discuss mailing list