> export a;
I think this is illegal, should be {a: a}

> var default = 1;
I don’t think you can do that, default is a keyword.

> export default;
without a thing to be exported as default, i believe this is illegal.

If I’m not wrong, all else are correct.

> On Dec 16, 2014, at 12:01 AM, Marius Gundersen <[email protected]> wrote:
> 
> So are all of these legal?
> ```js
> var a = 1;
> export a;
> 
> var b = 1;
> export default b;
> 
> export var c = 1;
> export var d = 1, e = 2, f = 3;
> ```
> What about:
> ```js
> var default = 1;
> export default;
> 
> var b = 1;
> export default b;
> ```
> Sorry for not being very good at reading EBNF
> 
> Marius Gundersen
> 
> On Mon, Dec 15, 2014 at 4:31 PM, Dave Herman <[email protected] 
> <mailto:[email protected]>> wrote:
> On Fri, Dec 12, 2014 at 8:19 PM, Glen Huang <[email protected] 
> <mailto:[email protected]>> wrote:
> You can already do "var a = 1;export default a;”. Why not make "export 
> default var a = 1;” valid?
> 
> Because the former is creating an exported variable called 'default' and 
> assigning its initial value to the result of evaluating an expression that 
> happens to evaluate the current value of 'a'. There's nothing special about 
> the fact that you used 'a' there, it's just an ordinary expression that 
> happens to evaluate a variable.
> 
> (For historical interest, this was why I was in favor of using the equals 
> sign in the syntax, to make it clear that export default is doing an 
> assignment of an initializer expression to a variable, e.g.:
> 
>   export default = a;
> 
> But this was unpopular and I didn't push the issue.)
> 
> At a more basic level, from a "principle of least surprise" perspective, I 
> would have no idea what `export default var a = 1;` was supposed to mean.
> 
> Dave
> 
> _______________________________________________
> es-discuss mailing list
> [email protected] <mailto:[email protected]>
> https://mail.mozilla.org/listinfo/es-discuss 
> <https://mail.mozilla.org/listinfo/es-discuss>
> 
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to