On Thu, Jun 19, 2014 at 4:04 PM, David Herman <[email protected]> wrote:

> On Jun 19, 2014, at 3:31 AM, Michał Gołębiowski <[email protected]> wrote:
>
> > 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 _;
> > ```
>
> My feeling is that the clutter is small, and it's acceptable to have it be
> slightly less minimal than default export since that is the case we are
> favoring. This isn't so cluttered as to be downright *punishing*
> multi-export utility modules (it's literally only two characters longer
> than your Node code, albeit admittedly a little chattier), but it's good
> that default import is the winner.
>

IMO it's not even that much a question of taken space but of potential
confusion. People will think if they can do:
```js
import * as _ from "lodash";
```
they can do:
```js
import * from "lodash";
```
as well. Also, there are reports of thinking that the first form exports
not only the _ container object but also all individual methods as in
Python.

I'd still prefer:
```js
import "lodash" as _;
```
I think it's less confusing that other proposals and reads naturally; it
also corresponds more to other module systems. But if that's out of the
picture, sth like:
```js
import module _ from "lodash";
```
would be IMO less confusing that the proposed `* as _` form.

-- 
Michał Gołębiowski
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to