Module Comments

Yehuda Katz wycats at gmail.com
Thu Dec 6 08:16:30 PST 2012


One plausible variant to our proposal that might be easier to swallow (as
it doesn't have the special-cased ObjectLiteral problem) is:

   - Replace `export ExportSpecifierSet` with `export ObjectLiteral` for
   static exports
   - Allow `export = foo` (or something like it) for single exports
   - Unify the import syntax to support the full destructuring syntax and
   to work on both static and single exports

This retains the advantages of reducing micro-syntax and reforming import
without forcing an awkward special-casing of `export ObjectLiteral`


On Thu, Dec 6, 2012 at 7:44 AM, Domenic Denicola <
domenic at domenicdenicola.com> wrote:

>  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> 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
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>


-- 
Yehuda Katz
(ph) 718.877.1325
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121206/12db75b1/attachment.html>


More information about the es-discuss mailing list