John Barton (2014-06-19T18:45:06.000Z)
dignifiedquire at gmail.com (2014-06-20T07:41:30.306Z)
> On Thu, Jun 19, 2014 at 10:48 AM, Axel Rauschmayer <axel at rauschma.de> wrote: > > On Jun 19, 2014, at 16:17 , John Barton <johnjbarton at google.com> wrote: > > Sorry to be dense, but I would appreciate more elaboration of this > sentence: > > > On Thu, Jun 19, 2014 at 3:40 AM, Axel Rauschmayer <axel at rauschma.de> > wrote: > >> This is a key sentence in David’s proposal: “ES6 favors the >> single/default export style, >> > > What is the "single/default" export style? If I understand this claim, it > says that a module will typically contain a single export statement, either > named 'default' or not. Is there any evidence to support this? Everything > I've seen contradicts this claim, assuming I understand it. > > > The syntax is ( > https://people.mozilla.org/~jorendorff/es6-draft.html#sec-exports ): > > export default AssignmentExpression > Yes, but I was not clear: where is the evidence that ES6 favors this form or single named export. My experience is opposite: the simple thing in ES6 is to export those things you want exported. If it's one thing, then one; if it's 6 things then 6. One is not favored. > and gives the sweetest syntax to importing the default. Importing named >> exports can and even should be slightly less concise.” >> > > Could you please give an example? In my experience, "export default" is > rare or at least divisive since it seems stylistically incompatible with > named exports. > > > I’m surprised, too. But that seems to be the feedback from people working > with large module-based client-side projects and from the Node.js > community: single exports are most common. > I still don't get it. If you want one export, just export one thing. If you want one big export object called _, then export var _ = {tons of stuffs} One of the best references for devs to understand modules: http://www.2ality.com/2013/07/es6-modules.html says: The syntax for importing a default export is similar to normal importing, but there are no braces To me this is a bug not a feature; we should keep it simple and just have one way to get one import from one export. Just to make a connection to the topic, Dave's intro says: We've consistently seen confusion between the semantics of ModuleImport and default export. For me this confusion lands on default export equally as 'module` import. I think in client-side projects, one class per module was reported as a frequent use case