Single import from modules without default export

Kevin Smith zenparsing at gmail.com
Wed Aug 6 11:38:42 PDT 2014


>
>
> You know, I hate even suggesting any syntax changes at this point, but if
> we ditched the whole "default" thing, we could probably also get rid of the
> curlies:
>
>     import readFile, writeFile from "node:fs";
>
> And then "* as" would fit in naturally:
>
>     import * as FS, readFile from "node:fs";
>
> I think this might result in on overall better user experience.  I'll
> experiment with this from a parsing standpoint.
>

Easy.  The changes would be:

    ImportDeclaration:
        import ModuleSpecifier ;
        import ImportList FromClause ;

    ImportSpecifier:
        ImportedBinding
        IdentifierName as ImportedBinding
        * as ImportedBinding

    ExportDeclaration:
        export * FromClause ;
        export ExportList[NoReference] FromClause ;
        export ExportList ;
        export VariableStatement
        export Declaration

    // ImportClause removed
    // NamedImports removed
    // ExportClause removed

Overall, this would a huge simplification for the module syntax and a win
for users.  All those curlies become tiring on the eyes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140806/2328ae43/attachment.html>


More information about the es-discuss mailing list