import script --> .esm

Matthew Robb matthewwrobb at gmail.com
Wed Sep 10 10:14:27 PDT 2014


So my thought based on this comment:
http://esdiscuss.org/topic/detecting-js-language-mode-for-tools#content-14

Why not deprecate sloppy-script mode explicitly and encourage the movement
to module-strict for all scripts moving forward. Once you do that then you
can make the decision to spec the legacy code path as separate from the
modern code path. Then implementors would already be adhering to the legacy
code path for existing stuff and a convention would need to be decided upon
(somewhere) for differentiating the from the new.

I would go so far as to suggest the file extension `.es` to denote this and
at some point a different mime-type probably. So files with .es extension
or that contain module syntax of any kind would be treated as modules and
anything not conforming to that would be treated like a sloppy script...
Including files imported from modules that don't meet either of those
requirements.


- Matthew Robb

On Wed, Sep 10, 2014 at 1:03 PM, Matthew Robb <matthewwrobb at gmail.com>
wrote:

> Yeah heres a bit more in depth discussion on the topic:
> http://esdiscuss.org/topic/detecting-js-language-mode-for-tools#content-12
>
>
> - Matthew Robb
>
> On Wed, Sep 10, 2014 at 12:53 PM, Todd Kennedy <todd at selfassembled.org>
> wrote:
>
>>
>>
>> On Sep 10, 2014, at 12:35, Allen Wirfs-Brock <allen at wirfs-brock.com>
>> wrote:
>>
>>
>> On Sep 10, 2014, at 9:28 AM, Matthew Robb wrote:
>>
>> As soon as the language decided it would have a differentiation for
>> modules vs scripts then it seems only natural that it should also specify
>> at least some generic means of entry into one mode or another. Then it's up
>> to browsers or who ever to determine what external signifiers would trigger
>> module instead of script. Or the language parsing logic could say that in
>> the presence of module syntax it will always be treated as module. I don't
>> know if that's feasible or not *shrug*
>>
>>
>> Modules and scripts can not always be identified by inspection.  Consider:
>>
>> foo.js -------------------------------
>> const answer = 42;
>> ---------------------------------------
>>
>> The semantics of this are quite different depending upon whether foo.js
>> is evaluated as a script or loaded as a module.
>>
>> Allen
>>
>>
>>
>> But why?
>>
>> To be completely serious. Why do we have to make a difference?
>>
>>
>> _______________________________________________
>> 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/20140910/186f9dbd/attachment.html>


More information about the es-discuss mailing list