simple modules

Brendan Eich brendan at mozilla.com
Mon Feb 1 14:33:03 PST 2010


On Feb 1, 2010, at 2:20 PM, Brendan Eich wrote:

>> The problem is not defending the integrity of X, Y and Z. The  
>> problem is this:
>>
>> import X as ...;
>
> In the proposal, the ... is the name of a first-class object you can  
> use to reference exports from X. If X exports f1 this form does  
> *not* bind f1 lexically in the importing scope.
>
> So
>
>  import "X" as X;
>  import "Y" as Y;
>  X.f1();
>  Y.f2();
>
> would be a minimal example of the importing code, if I am reading  
> between the lines correctly.
[...]
> In the proposal, and reading between your example's lines slightly  
> (again I'm assuming X exports f1, Y exports f2), f1 is statically  
> scoped to X, f2 is statically scoped to Y.

I clearly read between the lines differently from Allen and Sam -- but  
in my defense, their reading did not make any sense to me :-P.

If f1 and f2 are in the importing code, then there is no salient  
difference among the module system proposals.

And anyway, if you want to isolate things in your own code you can  
always wrap those things in modules as Allen said.

Perhaps the ambient authority issue to do with import "X"; (not import  
"X" as X; or import "X": f1) is the issue after all.

/be



More information about the es-discuss mailing list