treated as a module if ...

John Barton johnjbarton at google.com
Mon Jul 6 14:32:24 UTC 2015


On Sun, Jul 5, 2015 at 8:46 AM, Domenic Denicola <d at domenic.me> wrote:

> To be explicit: there is no way to look at a string of JavaScript text and
> tell whether it should be treated as a module or a script. In many
> instances the same string can be treated as both.



> The decision is made by the execution environment.
>

I don't think Domenic meant that the standard explicitly states that the
execution environment may choose the parse method.  Rather that the context
of loading the code determines the parsing method.

I believe that the current status is that the standard describes the two
parsing methods but says nothing about when they will be applied. We do
know that <script> tags always parse as Script.  Of course, modules
imported by import statements are parsed as Module.   Sadly, as far as I
know, there is no standard way to import a ES2015 root module. The
discussions on modules imply that there will be an explicit "loader" import
function that will parse as Module and there has been discussion of <script
type="module"> and <module> but these proposals are moving slowly if at all.


>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150706/a0b206ec/attachment.html>


More information about the es-discuss mailing list