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 <[email protected]>wrote:
> On 6 December 2012 17:33, Kevin Smith <[email protected]> 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
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
--
- Matthew Robb
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss