Modules: Name capture

Waldemar Horwat waldemar at google.com
Tue Jun 1 18:26:28 PDT 2010


ihab.awad at gmail.com wrote:
>   // one.js:
>   import jQuery.ajax;
>   module Two = load 'two.js';
> 
>   // two.js:
>   import jQuery.ajax;
> 
> At the time that "one.js" was written, "two.js" did not contain a
> reference to Drawing. Now, unbeknownst to the author of "one.js",
> "two.js" changed and now refers to something named Drawing, which it
> expected to draw a picture:
> 
>   // two.js:
>   import jQuery.ajax;
>   import Drawing.draw;
>   draw(); // intended to draw a picture

I don't understand your example of how this is supposed to work in the regular (non-accidental-aliasing) case.  As you wrote in your example, two.js evolves to reference the identifier "Drawing" unbeknownst to one.js.  There is no definition of it, so two.js wouldn't work at all.

    Waldemar


More information about the es-discuss mailing list