On Thu, Mar 22, 2012 at 4:54 PM, Brendan Eich <bren...@mozilla.org> wrote:
> John J Barton wrote:
>>
>> If I go back to my previous question, can we understand what should happen
>> here?
>>
>> if (version === 1)
>>  import y from 'lib1.js';
>> else
>>  import y from 'lib2.js';
>
>
> Again, no.

No, we can't understand this case? No, this is a compile error?

>
> 1. We are not breaking run-to-completion by nesting (conditionally on
> control flow) blocking event loops.

Where is the blocking event loop in the example above? I thought you
said the modules are pre-fetched.

>
> 2. Also we are not losing static binding by having the names injected by
> static syntactic forms depend on control flow dynamics.

Well the example has control flow dynamics and names, so what happens?

>
>
>> To me the answer should be that the lib1.js and lib2.js are fetched
>> (because I did not specify async). But they should not be executed (or
>> compiled IMO) until the statement executes. That does not seem to be what
>> Brendan thinks.
>
>
> Don't break the web.

Good advice to be sure ;-)

>
> Seriously, you want something that is not tenable for developers or browser
> implementors. Both 1 and 2 matter. You might argue 2 is not important but 1
> remains. TC39 wants dynamic things to be dynamic (modules reflect when
> passed to load callbacks as objects with properties), and static things to
> bind statically.

I'm not arguing for anything other than clarification.  Hopefully
someone will just tell me that import statements can never appear in
if statements.

jjb
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to