>I think it’s unfortunate that the only way to code for a web browser is to use JavaScript or a language that compiles to JavaScript. I feel there is no real reason browsers can’t support arbitrary <script type=""> tags. I discussed this last March.
I don't find that unfortunate at all. With one single standardized language we have fragmentation across browsers which sometimes causes problems. Allowing arbitrary languages would be a nightmare.
There is, of course, a workable way to do arbitrary languages already, which is to do it the way CoffeeScript and many of its cousins do it: implement the compiler in JS and compile your scripts to JS on the client side.
Would it be nice if such compilers could compile to a more sane and low level intermediate representation instead? Sure. But that's not the world we live in, or will likely ever live in (although maybe, if the IR were a subset of JS... but I digress).
> With one single standardized language we have fragmentation across browsers which sometimes causes problems. Allowing arbitrary languages would be a nightmare.
I'm not sure about that.
One thing i really dislike about web development is that it's so unnecessary complicated to say "i want to use ECMASript 5 for this web page" and then let the browser decide what to do, either just stupidly show an error message, or, more intelligently, download the necessary components to make ECMAScript 5 work, kind of what a package manager would do. If the web would have been polyglot from the start (in the scripting language side), i think it's not far fetched to imagine that browsers could have adopted a similar approach to the later one.
Really, i feel it's really stupid that we've been fallen into this "beware, <browser X> doesn't support Array::map!" trap, instead of "how silly, Array::map didn't exist because i didn't mark my <script> tag with language=ecmascript5, now it does :)". I can't but feel that Only One Scripting Language to Rule Them All mentality brought us here.
But anyway, the What Would Have Happened If won't take us anywhere. The decision for us to make is: do we embrace a polyglot/package managed like architecture now, or do we continue with (re)standardising the one and only web scripting language?
I don't find that unfortunate at all. With one single standardized language we have fragmentation across browsers which sometimes causes problems. Allowing arbitrary languages would be a nightmare.
There is, of course, a workable way to do arbitrary languages already, which is to do it the way CoffeeScript and many of its cousins do it: implement the compiler in JS and compile your scripts to JS on the client side.
Would it be nice if such compilers could compile to a more sane and low level intermediate representation instead? Sure. But that's not the world we live in, or will likely ever live in (although maybe, if the IR were a subset of JS... but I digress).