What if the `import "module/id";` form was an expression that evaluated to
the module instance object.

This means everything stays as it is now except we remove the ModuleImport
form and if you want to use the module instance object you can do: `var foo
= import "foo";`. You could also do `var { bar } = import "foo";`


- Matthew Robb


On Thu, Jun 19, 2014 at 10:48 AM, Axel Rauschmayer <a...@rauschma.de> wrote:

> On Jun 19, 2014, at 16:17 , John Barton <johnjbar...@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 <a...@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
>
> 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 think in client-side projects,
> one class per module was reported as a frequent use case:
>
> ```js
> // MyClass.js
> export default class {
>     ...
> };
>
> // main.js
> import MyClass from "MyClass";
> ```
>
>  --
> Dr. Axel Rauschmayer
> a...@rauschma.de
> rauschma.de
>
>
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to