ModuleImport

John Barton johnjbarton at google.com
Thu Jun 19 07:17:48 PDT 2014


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.


> 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.


>
>
> On Jun 19, 2014, at 12:31 , Michał Gołębiowski <m.goleb at gmail.com> wrote:
>
> Thanks, Dave, for bringing that up, it shows you're open for feedback.
> That said (bikeshed begins), what's wrong with:
> ```js
> import "fs" as fs;
> ```
> ? I feel that a lot of effort went in ES6 into reducing boilerplate via
> e.g. arrow functions, classes etc. but if you start with Node's require,
> this adds clutter. Compare these 3 forms of importing all the module
> "lodash" bindings to an object _:
> ```js
> var _ = require("lodash"); // Node
> import * as _ from "lodash"; // Dave's syntax
> import "lodash" as _;
> ```
>
>
> --
> Dr. Axel Rauschmayer
> axel at rauschma.de
> rauschma.de
>
>
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140619/910f685a/attachment.html>


More information about the es-discuss mailing list