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*


- Matthew Robb

On Wed, Sep 10, 2014 at 12:21 PM, Allen Wirfs-Brock <al...@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.  .js isn't
> something that has appeared in any standard, as far as I know.
>
> Allen
>
>
>
>
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to