Rationale for dropping ModuleImport syntax?
Mark Volkmann
r.mark.volkmann at gmail.com
Mon Jun 9 08:06:46 PDT 2014
I would like to see a reigning in of uses of curly braces. We already have
at least these:
1) code blocks
2) literal objects
3) destructuring
I don't like that the module syntax adds yet another. I'd like to think of
the curly braces in the module syntax as being like destructuring. That way
the mental model could be that whenever you see curly braces on what is
conceptually the left-hand side of an expression, you can at least think of
it as being like destructuring.
So the following would mean I want all the exports as a single object:
import fs from "fs";
and the following would mean I only want some of the exports from a module:
import {mkdir, write} from "fs";
Maybe the following could be used to get the "default" export from a module:
import default fsd from "fs";
On Mon, Jun 9, 2014 at 9:51 AM, Axel Rauschmayer <axel at rauschma.de> wrote:
> I’m assuming that people will default-export objects (for
> Underscore.js-like libraries). I’d call those pseudo-modules, because one
> would be partially working around the module system (no load-time errors!).
>
> Maybe we’ll import modules like this [^1], but that feels syntactically
> inconsistent to me and you don’t get load-time errors, either:
>
> ```js
> import "Underscore";
> const _ = System.get("Underscore");
> ```
>
> [^1]: https://gist.github.com/domenic/2230a7195fa0de31a227
>
>
>
> On Jun 9, 2014, at 16:28 , John Barton <johnjbarton at google.com> wrote:
>
>
>
>
> On Mon, Jun 9, 2014 at 6:54 AM, Axel Rauschmayer <axel at rauschma.de> wrote:
>
>> On the other hand, we’ll have many pseudo-modules, which is also a
>> barrier against making progress later on.
>>
>
> Sorry, I don't understand what a pseudo-module is. Are you saying that the
> core import/export system is not correct and that we should have a system
> based exclusively on 'module'?
>
> jjb
>
>
> --
> Dr. Axel Rauschmayer
> axel at rauschma.de
> rauschma.de
>
>
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
--
R. Mark Volkmann
Object Computing, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140609/b9b22d91/attachment.html>
More information about the es-discuss
mailing list