@name module API

Brendan Eich brendan at mozilla.org
Fri Apr 13 20:20:30 PDT 2012


Erik Arvidsson wrote:
> We should really use ''new Name'' instead of ''create''.
>
> import {Name} from '@name';
> let myName = new Name;
>
> instead of
>
> module name = '@name';
> let myName = name.create();

To be less content-free in my +1, it seems to me one should always be 
able to use an identifier as a pattern:

import Name from '@name';
const myName = new Name;


And the built-in module might be named "@std" instead, per 
http://wiki.ecmascript.org/doku.php?id=harmony:modules_standard, so we'd 
have

import Name from '@std';
const myName = new Name;


If we can agree that some <script> element variant imports * from "@std" 
implicitly as a standard prelude, then we have:


const myName = new Name;


which seems winning to me.

/be


More information about the es-discuss mailing list