module exports

Domenic Denicola domenic at
Fri Mar 14 12:30:23 PDT 2014

From: es-discuss <es-discuss-bounces at> on behalf of David Herman <dherman at>

> So I think we should consider doing the same thing as we do for ExpressionStatement:
> ...
> This actually results in no net change to the language syntax, but it allows us to change the scoping rules so that function and class declarations scope to the entire module:

This seems nice; a tentative +1. I like how surgical of a change it is.

Personally I have not found the current state confusing. `default`, just like `yield` or `return` or `throw` or  others, was a fine signifier for me that we're entering an expression context. But since others don't seem to have adapted, perhaps this will help them. And it is definitely convenient in cases where you want to refer to the default export elsewhere within the module.

More information about the es-discuss mailing list