simpler, sweeter syntax for modules
rossberg at google.com
Thu Mar 22 04:47:19 PDT 2012
On 22 March 2012 07:12, David Herman <dherman at mozilla.com> wrote:
> On Mar 21, 2012, at 9:01 PM, Axel Rauschmayer wrote:
> > I like variant B, because it follows the rules:
> > - "module" => define a module
> > - "import" => extract something out of a module
As Dave already mentioned, that is my stance, too. Despite what newcomers
might think initially, I think this is cleaner and ultimately less
confusing because it is a better match for the actual semantics.
Sure, but note that you can import a sub-module, so it's not a *totally*
> clean split.
True, but 'import' overlaps with 'module' just as it overlaps with e.g.
'let' or 'const' in that respect.
> But I would use a keyword instead of "=" (due to the reason that you
> mentioned). Compare:
> > module Bar = "bar.js";
> > module Bar is "bar.js";
> > module Bar from "bar.js";
> > module Bar in "bar.js";
> > module Bar via "bar.js";
> > I’m not entirely happy with either one of these keywords, but they all
> seem better to me than the equals sign. So any other keyword is fine by me,
> I think the = sign looks the cleanest.
> No "from" -- we have to be consistent that "from" only means extraction.
> The others all just look awkward.
Missing from the list is
module Bar at "bar.js"
which was shortlisted for a while as an alternative to '=' for external
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss