Module Comments

Matthew Robb matthewwrobb at gmail.com
Thu Dec 6 08:46:30 PST 2012


What about trying it the other way, flip everything.

import "foo" as bar;
import "foo" as { baz }


On Thu, Dec 6, 2012 at 8:42 AM, Andreas Rossberg <rossberg at google.com>wrote:

> On 6 December 2012 17:33, Kevin Smith <khs4473 at gmail.com> wrote:
> >> The downside is that it introduces a severe anomaly into the module
> >> semantics (a module which actually has no instance). I could live with
> >> this feature if we were to find a way to explain it in terms of simple
> >> syntactic sugar on both the import and export side, but screwing and
> >> complicating the semantics for minor syntactic convenience is not
> >> something I am particularly fond of.
> >
> > What if this:
> >
> >     export = "boo";
> >
> > Actually creates a static export with some exotic name, say __DEFAULT__
> (for
> > the sake of argument) and initializes it to the value "boo".
> >
> > And this form:
> >
> >     import boo from "boo.js";
> >
> > Creates a binding to __DEFAULT__ in "boo.js", if it exists, or to the
> module
> > instance of "boo.js" otherwise.
> >
> > Would that work as a desugaring?
>
> I suggested something along these lines at some point in the past, but
> there were some concerns with it that, unfortunately, I do not
> remember. Maybe it can be resolved.
>
> Note, however, that you still assume some hack in the semantics with
> the "if it exists" part. To avoid that, you need to divorce the import
> syntax from the naming-an-external-module syntax -- which I'd actually
> prefer anyway, and which was the case in the previous version of the
> proposal.
>
> /Andreas
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>



-- 
- Matthew Robb
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121206/c602d7ff/attachment.html>


More information about the es-discuss mailing list