Module Comments

David Herman dherman at mozilla.com
Thu Dec 6 00:49:56 PST 2012


On Dec 5, 2012, at 11:52 PM, Brendan Eich <brendan at mozilla.org> wrote:

>>>     ExportDeclaration: "export" "{" ExportSpecifier ("," ExportSpecifier)* "}" ";"
>>>     ExportDeclaration: "export" Identifier ("," Identifier)* ";"
>>>     ExportDeclaration: "export" "*" "from" StringLiteral ";"
>> 
>> Reasonable point, I'll think about that.
> 
> We do not so limit var, let, or const -- why should we limit export? Ok, it's a bit different (but then import is not, right?).
> 
> Style enforcement should not be wired into the grammar. If I want to write
> 
>  export {odd, even}, {nat: naturals};
> 
> why not?

Fairly agnostic about this, given that you can express most combinations within the { ... } form. But I'll think about it.

>>> Removing the curlies for this simple case would seem like a win.
>> 
>> Another fair point. I think it might've just been a refactoring oversight.
> 
> Cool, definitely want the plain identifier form, it's part of the binding (and destructuring) pattern language.

Well, the thing is it isn't consistent with the destructuring meaning: dropping the curlies here means extracting a single export (aka property), which is not what it means in destructuring assignment/binding anywhere else.

But that said, the convenience may well still trump the inconsistency.

Dave



More information about the es-discuss mailing list