Modules: Curly Free

Andreas Rossberg rossberg at google.com
Mon Apr 22 05:18:05 PDT 2013


On 21 April 2013 04:15, David Herman <dherman at mozilla.com> wrote:
> On Apr 20, 2013, at 5:17 AM, Brendan Eich <brendan at mozilla.com> wrote:
>
>> Andreas Rossberg wrote:
>>> I don't understand. Are you saying that it has a higher cost to
>>> standardize a trivial convention than it is to standardize additional
>>> ad-hoc syntax?
>>
>> Answering for Dave: you bet it is.
>>
>> The cost of the former is born by everyone in a large-N community who must learn the "trivial convention". The cost of the latter is born by we few TC39ers and JS implementors, who can make that sacrifice.
>>
>> Recall Mr. Spock's Kobayashi Maru solution from STII:TWoK.
>
> Thanks, and let me also add the following points:
>
> "Standardize additional ad-hoc syntax" is seriously hyperbolic. Anonymous export is simply about allowing library authors to indicate a module's main entry point. Semantically, we're talking about the difference between a string and a symbol; syntactically, we're talking about one production. It's all cleanly layered on top of the rest of the system. Let's keep some perspective.
>
> Moreover, "ad-hoc" seems to suggest some sort of arbitrariness, as if it's not well-motivated. It is in fact well-motivated, by a real requirement that otherwise requires a manual design pattern -- on the part of both the creators *and* the clients of libraries, note well! In fact, I've seen the design pattern arise in practice in other languages. And yet in existing JS module systems, no such pattern is required of a library's clients. (The clients are of course the important case. Yet another instance of the applicability of Mr. Spock's solution!)

I'm sorry, but I'm afraid this is one of these moments where I have no
idea what the heck you guys are talking about. ;)  It is a trivial
naming convention, for a single identifier! How is a single name
possibly more difficult to learn or remember than any additional piece
of syntax, however simple that may be? And how is calling it a "manual
design pattern" less hyperbolic?

> I am constantly, repeatedly met with impassioned requests [*] for anonymous export support by JS developers of multiple communities, e.g., NPM and AMD users alike. Do we wish to just ignore them? Do we favor minor convenience of engine implementors over the readability and clarity of every client of large numbers of idiomatic JavaScript modules?

I am aware that there are a lot of requests from some communities. If
they think this is an important feature to have -- in the context of
ES6 modules! -- then we should invite them here to make their case. So
far, they haven't, and despite what you say above, I have yet to hear
a compelling argument. As Kevin rightly points out, it is a fallacy to
extrapolate the need for the convenience of this feature from AMD &
friends. As for "clarity" or "readability", I don't see it either.

/Andreas


More information about the es-discuss mailing list