On Jan 4, 2012, at 4:12 AM, Andreas Rossberg wrote:
>> Your (3) seemed to say "use module" was something distinct from (and also
>> implicit in, so a part but not the whole of what is declared by) module
>> declaration syntax. It's not -- as proposed, it's an alternative to explicit
>> anonymous module{...} bracketing syntax that translates the block or body
>> enclosing the pragma to an anonymous module.
>
> Yes, I understand that. My point was that you can reformulate all
> that, for (almost) equivalent effect, by saying that "use module" is
> _not_ a module definition, but basically the same mode pragma as
> before,
Just to be clear: you mean |use version 6;| here by "mode pragma as before"?
> except that it now is implicit with every module body.
Assuming you do, then there is a difference -- see below.
> The only difference I can see with this description is its effect on
> the semantics of multi-part scripts.
Dave's proposal has
<script>
window.foo = "hi";
</script>
<script>
use module;
alert(foo);
</script>
desugar to
<script>
window.foo = "hi";
</script>
<script>
module {
alert(foo); // no early error, runs and alerts "hi"
}
</script>
which is not the same as what we were thinking of with "no global object as top
scope" enabled by a version pragma:
<script>
window.foo = "hi";
</script>
<script>
use version 6;
alert(foo); // early error here!
</script>
/be
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss