A few more questions about the current module proposal

Jussi Kalliokoski jussi.kalliokoski at gmail.com
Wed Jul 4 09:29:23 PDT 2012

Hello, good people,

I fear I have some misunderstanding going on with the current module
proposal, as well as outright ignorance, hence I'd like to get answers to a
few questions, as I'm pretty sure I'm not the only one. :)

1) How does the static resolution and static scoping behave when out of the
normal context. As an example if `import` is in an `eval()` call, what
would happen:

var code = loadFromURL('http://example.org/foo.js') // content: `import foo
from "bar"`
console.log(foo) // ???

Would this example block until the module is resolved and loaded? Would it
throw? What happens, exactly? As my $0.02 goes, I think it's a bad idea to
ban import in eval.

2) How does the module proposal address the increasing need for interaction
between pure JS and compile-to-JS languages? (CoffeeScript, Haxe, JS++,
JS*, etc)?

More specifically, can you add hooks to preprocessing the files? If not,
why? I think it would break static module resolution, but are we certain
that static module resolution is worth the price of excluding JS
preprocessors of the module system (aside from server-side preprocessing
that is)? Again, my personal opinion is that including compile-to-JS
languages in the module system would be worth much more than static
resolution, but feel free to enlighten me.

I'm sorry if these questions have been answered already, I'm trying to keep
up with the discussion, but there's always something I'll miss/overlook I
guess. I'll probably have more questions after these are answered but bare
with me.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120704/5ef12783/attachment.html>

More information about the es-discuss mailing list