detecting JS language mode for tools

Brendan Eich brendan at mozilla.com
Fri Jan 24 18:33:06 PST 2014


John Barton wrote:
> On Fri, Jan 24, 2014 at 12:17 PM, Allen Wirfs-Brock 
> <allen at wirfs-brock.com <mailto:allen at wirfs-brock.com>> wrote:
>
>     I should have also included:
>
>     2A) Hopefully, overtime, the old script syntactic goal will fade
>     from use, and the module goal will become the norm for new code.
>
>
> Now here is a reason, finally, for all the extra complexity the two 
> goals cause.
>
> If we want to kill script, let's not stab it with a dull pencil. Let's 
> make Loader and System be modules, not globals. Then you cannot load 
> modules with <script>, only with <module>.

We are not killing <script>> Dream on!

Introducing a new HTML element with implicit CDATA content model will 
require the old

<module>
<!-- hide script here
if (a < b) { console.log("<\/script> haha"); }
-->
</module>

hacks. This won't do anything (even render the HTML-commented-out 
fallback content) in old browsers, which will make it hard to work in 
both new and old.

Using <script> with a new attribute has several advantages, in contrast:

1. No need for the return of the HTML comment-hiding hack I invented in 
Netscape 2 to avoid inline script content showing as fallback in 
pre-Netscape-2 browsers.

2. Old browsers ignore the new attribute will process the content, which 
could be written to work "both ways".

But mainly: no way to kill script. Amending above words: do not dream 
on, wake up!

/be


More information about the es-discuss mailing list