Module Comments

Domenic Denicola domenic at domenicdenicola.com
Thu Dec 6 07:44:56 PST 2012


For the record, here's the idea Yehuda and I worked out:

https://gist.github.com/1ab3f0daa7b37859ce43

I would *really* appreciate if people read it (it's easy reading, I promise!) and incorporated some of our concerns and ideas into their thinking on module syntax.

In general, it tries to eliminate the ExportSpecifierSet and ImportSpecifierSet microsyntaxes in favor of standard object literal/destructuring forms, respectively. It also made export and import syntax symmetric.

It apparently failed to get much traction among committee members, mainly because of objections to our reformation of the export-side syntax. (Second-hand info.) E.g. the current export function foo() { } was preferred to the proposed export { foo() { } }, and---less aesthetically---our special behavior for ObjectLiteral expressions over other expressions was a bit weird.

I still think the import-side reformation is important and stand by everything in the proposal in that regard. As mentioned in other messages in this thread, the current form is confusingly dual-natured. And I maintain that the incomplete semi-destructuring microsyntax of ImportSpecifierSet adds a lot of cognitive burden.

If we can start by fixing the import side, I have some other ideas on how to make the export side better that hopefully will be more appealing to the committee. But I don't want to try proposing those yet until we can get the buy-in on fixing import.

________________________________
From: es-discuss-bounces at mozilla.org [es-discuss-bounces at mozilla.org] on behalf of Erik Arvidsson [erik.arvidsson at gmail.com]
Sent: Thursday, December 06, 2012 09:54
To: Kevin Smith
Cc: es-discuss
Subject: Re: Module Comments


On Thu, Dec 6, 2012 at 9:42 AM, Kevin Smith <khs4473 at gmail.com<mailto:khs4473 at gmail.com>> wrote:
Dave responded by pointing out that we don't want "from" to have overloaded semantics.  I actually think this form has potential, because it further aligns import with the other binding forms:

    var a = x;
    var { b } = y;

    // Symmetry!

    import a from "x";
    import { b } from "y";

+1

This also matches what Yehuda and Domenic proposed a few weeks ago.

--
erik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121206/9d63a675/attachment.html>


More information about the es-discuss mailing list