treated as a module if ...

John Lenz concavelenz at gmail.com
Sun Jul 12 21:05:07 UTC 2015


I thought at one time a naming convention was proposed:  x.m.js for es6
modules. But I haven't seen any traction for it.
On Jul 6, 2015 12:08 PM, "Allen Wirfs-Brock" <allen at wirfs-brock.com> wrote:

>
> On Jul 6, 2015, at 7:32 AM, John Barton wrote:
>
>
>
> 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.
>
>
> In other words, every tools (including command line based execution
> engines) that parse ES2015 source code really needs  to make provisions for
> the user to identify how each source file will be parsed. It might be with
> a command line flag or by interpreting extensions, or some other way.
>
> For example, traceur (
> https://github.com/google/traceur-compiler/wiki/Options-for-Compiling )
> defaults to parsing source files as modules but provides a command line
> switch for identify file that need to be parsed as scripts:
>
> traceur --script main.js mod1.js mod2.js
>
> apparently will parse main.js as a script and mod1.js and mod2.js as
> modules.
>
> It would be nice for a common command line convention to emerge that all
> js source level tools followed.  How about tool developer put your head
> together and decide on something.
>
> Allen
>
> _______________________________________________
> 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/20150712/288dc04f/attachment.html>


More information about the es-discuss mailing list