Domenic Denicola (2012-12-20T04:20:56.000Z)
github at esdiscuss.org (2013-07-12T02:26:06.471Z)
From: es-discuss-bounces at mozilla.org [mailto:es-discuss- bounces at mozilla.org] On Behalf Of Brendan Eich Sent: Wednesday, December 19, 2012 23:11 > In a thread you may not have caught up on, Andreas did argue for a special form such as > module foo at "foo"; > for anonymous import, so that the system can check that "foo" indeed does > export = ... > and throw otherwise. Sorry if you did see this and reply (in which case I missed the reply!). If not, whaddya think? IMO this is undesirable. In such a situation, modules can no longer be abstraction boundaries. Instead you must peek inside each module and see which form it exported itself using. If we instead had import foo from "foo"; where `foo` became either the module instance object (in the multi-export case) or the singly-exported value (single-export case), abstraction boundaries are preserved much more neatly. This goes both ways, of course. I.e., ideally, this should work too: ```js module "glob" { function glob() { } glob.sync = function () { }; } import { sync } from "glob"; ``` (see https://npmjs.org/package/glob) This was much of the motivation behind Yehuda and I's proposal, FWIW.