4 ms·
I never got why there is just one. The script tag can take any number of languages.
by 6510 5y ago
I never got why there is just one. The script tag can take any number of languages.
- krapp 5y agoWhile support for multiple languages was the plan all along (the spec for the script tag mentions "text/tcl" along with javascript and vbscript)[0,1], browser makers never bothered to support other languages when javascript became the popular choice, apart from Microsoft with VBScript and Chrome with Dart, whose languages were vendor specific. Eventually, people just compiled code written in other languages into Javascript, treating it more as an "assembly language for the web"[2] than a language directly coded in, and the script type attribute was officially deprecated from the script tag in HTML5. [0]https://www.w3.org/TR/REC-html40/interact/scripts.html https://www.w3.org/TR/REC-html40/interact/scripts.html [1]https://eager.io/blog/a-brief-history-of-weird-scripting-languages/ https://eager.io/blog/a-brief-history-of-weird-scripting-lan... [2]https://www.hanselman.com/blog/javascript-is-assembly-language-for-the-web-sematic-markup-is-dead-clean-vs-machinecoded-html https://www.hanselman.com/blog/javascript-is-assembly-langua...
- 6510 5y agoWhat properties would a new language make an interesting alternative? What common problem suffers the most solved in js? Preferably something without hope for improvement.
- krapp 5y agoGiven how practically all Javascript nowadays is generated by Typescript or other compile-to-js languages, probably a stricter type system, actual integers and doubles (JS only uses floats,) maybe as often mentioned, a bigger standard library. There probably isn't much benefit to different languages if you're just manipulating the DOM (which is probably why that model failed, having more than one language doing the exact same thing is needless extra complexity) but using the browser as an application runtime opens up the possibility of making any software written in a supported language accessible and executable from a URL. The "JS as bytecode" model got us surprisingly far, but it was a disgusting hack, and Java applets and Flash had their day in the sun, but Webassembly is probably what's going to make the "multiple scripts in the browser" model eventually feasible.
- 6510 5y agoThinking about it there are so many angles from which one could approach it. It could not be required to run the script. For example require the visitor has his own website and have the script interact with specified tools installed there. Or a very limited language that disables js for security. It could be a highly readable DSL, for example something to write interpreters in. Or something narrow like interact with a rich text editor or data visualizations. Perhaps a basic game engine.