detecting JS language mode for tools

Brendan Eich brendan at mozilla.com
Mon Jan 27 18:01:44 PST 2014


John Barton wrote:
> On Mon, Jan 27, 2014 at 4:57 PM, Brendan Eich <brendan at mozilla.com 
> <mailto:brendan at mozilla.com>> wrote:
>
>     John Barton wrote:
>
>
>
>             It's pretty clear from NPM experience that a new suffix is not
>             needed for out-of-line modules. Or are you suggesting that
>         Node.js
>             lacks tooling? I'm not offended, just trying to understand.
>
>
>         What about the node experience helps? They have only one type
>         of input, modules, ergo only one suffix.
>
>
>     No, their non-module main programs are in files with names ending
>     in .js.
>
>
> Their non-module main programs don't fail if you issue require().

Nor do browserify'ed or properly-written require.js client main scripts.

>
>
>             For NPM read AMD/require.js too.
>
>
>         Ditto.
>
>
>     No, <script src=foo.js> interops with AMD/require.js and the .js
>     suffix is used everywhere.
>
>
> Because it is js everywhere. Pick any file in an AMD/require.js system 
> and you can parse it.

ES6 cannot support require as a function that synchronously loads from 
the filesystem, and I think you know this.

> I think you are on the right track here: 1JS needs only one file 
> suffix.  If we have two languages, we need to suffixes.

You do not have two languages, though. Two entry points to the grammar 
of the one language does not make "two languages". HTML event handlers 
are FunctionBodies. I think you have no argument.

/be


More information about the es-discuss mailing list