Module: export *

# Erik Arvidsson (12 years ago)

Both the wiki and the ES6 draft have the following as valid ExportDeclaration:

export *

(without a from ModuleSpecifier)

What is the intended semantics for that?

# Sam Tobin-Hochstadt (12 years ago)

This exports all of the declarations defined in the current module. So:

let x = 1;
class foo {};
export *;

exports both x and foo.

# Erik Arvidsson (12 years ago)

Make sense but I'm not sure it is needed/desired.

Where is this documented?

# Sam Tobin-Hochstadt (12 years ago)

On Thu, Oct 31, 2013 at 11:06 AM, Erik Arvidsson <erik.arvidsson at gmail.com> wrote:

Make sense but I'm not sure it is needed/desired.

It's very useful for convenience libraries, quick refactorings, etc. In other languages, I use it a lot.

Where is this documented?

It's very briefly described in the wiki page, and fully specified in the spec documents in the js-loaders repository jorendorff/js-loaders (although there's lots of churn in some parts of those documents).

# David Herman (12 years ago)

On Oct 31, 2013, at 8:06 AM, Erik Arvidsson <erik.arvidsson at gmail.com> wrote:

Make sense but I'm not sure it is needed/desired.

I agree, actually, despite being the one who put it in there in the first place. I originally intended it as a convenience e.g. for quick scripts. But by itself it's simply too brittle to work with; as soon as you have an internal definition you don't want to export you can't use it -- other languages have a way of blacklisting bindings but the export syntax starts getting too baroque so I never went there.

I do suspect Sam has a point, that in time people will start wishing for some of the conveniences we've eliminated. But I'm happy to revisit it in ES7. For now, though, it doesn't make sense to have export *; by itself, without additional constructs that make it more usable. Call this... maximally minimal export syntax. ;-P