ModuleImport
Kevin Smith
zenparsing at gmail.com
Wed Jun 25 23:15:27 PDT 2014
On Wed, Jun 25, 2014 at 4:50 PM, C. Scott Ananian <ecmascript at cscott.net>
wrote:
> @John Barton: Yes, ideally that syntax would work as well when you don't
> need a namespace. But sometimes you do need a namespace, even if you don't
> care precisely what it is:
> ```
> import {format} from 'url';
> import {format} from 'util';
> import {connect} from 'tls';
> import {connect} from 'net';
> import {fork} from 'cluster';
> import {fork} from 'child_process';
> // etc
> ```
>
I agree, and importing as a namespace is what ModuleImport is all about.
Crazy idea: what if we had this:
// ModuleImport: import Identifier from StringLiteral
import fs from "fs";
import url from "url";
And just got rid of the default monkey-business? Simple, no confusion, no
refactoring hazards.
Do we *really* need assignable default exports? If we could jettison that
feature, it would (as John points out) make all of this pain go away.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140626/2198b9dd/attachment-0001.html>
More information about the es-discuss
mailing list