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

Glen Huang curvedmark at gmail.com
Mon Dec 15 07:06:07 PST 2014


Just looking for symmetry with the "export var a" syntax.

But yeah, maybe the proposed syntax is a bit tricky, and is probably not a very good idea.

> On Dec 15, 2014, at 10:45 PM, Erik Arvidsson <erik.arvidsson at gmail.com> wrote:
> 
> Keeping syntax minimal, simple and unsurprising is part of our job.
> 
> Why do you want this?
> 
> 
> On Mon, Dec 15, 2014, 09:41 Caridy Patino <caridy at gmail.com <mailto:caridy at gmail.com>> wrote:
> No.
> 
> On Dec 15, 2014, at 6:26 AM, Glen Huang <curvedmark at gmail.com <mailto:curvedmark at gmail.com>> wrote:
> 
>> What about this:
>> 
>> export default var a, b, c;
>> 
>> is equivalent to 
>> 
>> var a;
>> export default a;
>> 
>> export var b, c;
>> 
>> 
>>> On Dec 13, 2014, at 12:44 PM, Kevin Smith <zenparsing at gmail.com <mailto:zenparsing at gmail.com>> wrote:
>>> 
>>> From https://people.mozilla.org/~jorendorff/es6-draft.html#sec-exports <https://people.mozilla.org/~jorendorff/es6-draft.html#sec-exports>, it seems that "export default var a = 1;” is not valid in es6. I wonder why that’s the case. You can already do "var a = 1;export default a;”. Why not make "export default var a = 1;” valid?
>>> 
>>> Exporting a variable declaration list as "default" wouldn't make sense:  for one, the list can have more than one element:
>>> 
>>>     export default var a, b, c;  // Non-sensical
>>> 
>>> 
>> 
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org <mailto:es-discuss at mozilla.org>
>> https://mail.mozilla.org/listinfo/es-discuss <https://mail.mozilla.org/listinfo/es-discuss>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org <mailto:es-discuss at mozilla.org>
> https://mail.mozilla.org/listinfo/es-discuss <https://mail.mozilla.org/listinfo/es-discuss>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20141215/76a93846/attachment-0001.html>


More information about the es-discuss mailing list