module exports

David Herman dherman at
Sun Jul 10 20:11:52 PDT 2011

> According to the module grammar, the following is valid:
> 691module car {
>   function startCar() {}
>   module engine {
>     function start() {}
>   }
>   export {start:startCar} from engine;
> }
> It seems like there would be issues with exporting module elements after the module has been defined.

I don't see any conflicts with the code you wrote, but it does contain a linking error, because the car module doesn't have access to the unexported start function. Maybe you intended:

    module car {
        export function startCar() { }
        module engine {
            export function start()  { }
        export { start: startCar } from engine;

In this case, you have a conflict, because the car module is attempting to create two different exports with the same name. This is an early error.

> Also, what is the behavior of aliasing over existing Identifiers? Would the compiler fail or would behavior 
> be the 'last' Identifier wins?

Early error.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list