On Thu, Jun 26, 2014 at 7:39 AM, Axel Rauschmayer <a...@rauschma.de> wrote:
> // my-class.js > export class MyClass { > constructor() { ... } > method() { ... } > } > > // use-class.js > import { MyClass } from "my-class.js"; > > > You do have redundancy in `my-class.js` and, as Marius pointed out, the > importer has to know both the name of the module and the name of the entity > inside the module. Not that big of a deal. > But these examples are misleading. "my-class.js" is not the name of the module. Its is a module identifier, and probably incorrect since the identifier is both absolute and ending in .js. A more realistic example is import {MyClass} from "./pretentious/kernel/core/util/my-class"; In the big picture the time to type a few characters in regular pattern is completely overwhelmed by the time it takes to figure out what MyClass does and where it lives. > Again, standardizing on `_` for default exports helps, > I guess you meant "developers may choose to adopt short export identifiers"; I don't suppose you are proposing to standardize _. > but then importing is more verbose: > > // my-class.js > export class _ { > > constructor() { ... } > method() { ... } > } > > // use-class.js > import { _ as MyClass } from "my-class.js"; > > -- > Dr. Axel Rauschmayer > a...@rauschma.de > rauschma.de > > > > > _______________________________________________ > es-discuss mailing list > es-discuss@mozilla.org > https://mail.mozilla.org/listinfo/es-discuss > >
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss