import script --> .esm

Mark S. Miller erights at google.com
Wed Sep 10 14:56:28 PDT 2014


On Wed, Sep 10, 2014 at 9:21 AM, Allen Wirfs-Brock <allen at wirfs-brock.com>
wrote:

>
> On Sep 10, 2014, at 8:44 AM, Matthew Robb wrote:
>
> Personally I have felt this way for a long time as well. I think `.esm` is
> somewhat confusing since most js developers don't really think about it as
> EcmaScript. I would think you could just as easily do `.jsm` but this also
> suggests that files of this alternate should be served with a different
> mime type such as `text/javascript-module` or something along those lines.
>
>
> I also agree (and have argued) that an external discrimination of modules
> and scripts is going to be a practical necessity and that file extension is
> the most natural way to do so.  Consider a couple basic situations:
>
> 1) linters need to know whether whether to apply script or module
> (including implicit strict) to the source files they process.
>
> 2) a command line js engine needs to know which source files listed on the
> command line are intended to be processed as scripts which need to be
> loaded as modules.
>
> command line switches or other affordances could be used to make this
> discrimination.  But file extensions are the more traditional approach.
>
> But, such conventions seem to be outside the scope of ECMA-262.
>

Since it isn't in any else's scope, I propose it be in our's.

TC39 has other advisory outlets other than the 262 spec, such as <
http://wiki.ecmascript.org/doku.php?id=conventions:conventions>. If there
are no objections to recommending .js vs .jsm in this informal way, I
propose that we place it there. With <
http://wiki.ecmascript.org/doku.php?id=conventions:no_non_standard_strict_decls>,
we successfully got agreement across all implementations of something we
(accidentally?) omitted from the ES5 spec -- in time to make lexically
scoped functions possible in ES6/strict.

If we also come to an informal consensus about mime type, we could also
record it in this namespace. Or not.



>  .js isn't something that has appeared in any standard, as far as I know.
>
> Allen
>

-- 
    Cheers,
    --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140910/9f9d8419/attachment-0001.html>


More information about the es-discuss mailing list