9 ms·
Ask HN: Would the web be a better place with a CLR or JVM in the browser?
While I don't mind coding with JavaScript, I'd much rather use the language of my choice both within the browser and in server-side code.
There exist dozens of languages and language enhancements designed to be compiled to JavaScript for running within a browser. While performance may be acceptable with modern browsers, the developer experience is still far from perfect: The debugger doesn't let you step through your original source and the languages available are limited.
If browsers were to build in a language runtime, such as a CLR, the choice of 'native' browser languages would expand greatly - and include languages such as : Java, C#, Python, Ruby, Haskell, Scala, Erlang and OCaml/F#. JavaScript would be supported on the same runtime of course!
An interesting 'feature' would be that tools like .NET Reflector could be developed to 'decompile' VM bytecode found in any page back to whatever language the developer preferred. Of course this wouldn't be perfect, but if you're used to working with C# and the original code was written in Scala, you would likely find that the decompiled version looked similar enough for you to work with it.
I'm leaning towards preferring a CLR rather than a JVM, as what I've read suggests that it's easier to get Java (the language) and JVM code (via IKVM) working on a CLR than C# and .NET code working on a JVM.
- anonyfox 13y agoI tend to disagree. As of today, Javascript is the least common denominator of all the advanced web technologies. If you know JS fairly well, you're able to understand nearly everything under the hood if you want to. If you have CLR/JVM in addition, this just brings more problems to the table, especially when you have to deal with much more languages which do not "compile" to JS or when you have to deal with proprietary APIs/Libraries. At the end of the day, "what can be written in Javascript will be written in Javascript", thus whatever functionality you want from other technology stacks will be available sooner or later, and is usable from your preferred "compiles to JS" language of choice. If you want a neat debugger, try Typescript maybe? If you like to think functional, give Livescript a shot. Only want class-based OOP and a fairly expressive syntax? Then just use Coffeescript. Or just use Javascript as is if you like it. When you need more performance, check out ASM.js if it fits. Thanks to Emscripten you may even use languages like C++ for your web development.
- rikkus 13y agoI wasn't suggesting any proprietary APIs or libraries - only that we get to use the /language/ of our choice. Also I'm not talking about 'functionality [...] from other technology stacks' - I'm talking about getting to choose the programming language. To current client code, everything would function exactly as before. It's just that you would be able to write new code in any language that can compile to the bytecode the VM understands. The set of languages available through Emscripten doesn't compile most popular languages. If it did, it would likely fulfil what I'm hoping for, but I'd still be interested in whether it's the best option to compile to a subset of JS in order to run on a VM designed for JS.
- anonyfox 13y ago<opinion> I'd prefer the JVM/CLR-Stacks fading away alltogether. An exhaustive Toolchain like Java has + a fairly superior IDE like Visual Studio, both targeted especially for the JS-Stack, and everyone wins. If there is enough desire, every possible language can be ported over to the JS-stack. For me it's contra-productive to have too much languages to choose from. </opinion>
- levicampbell 13y agoJust out of curiosity, what's wrong with tools that compile to javascript? (i.e. CoffeScript, ClojureScript, pyjamas, and the like.)
- chc 13y ago> I'd prefer the JVM/CLR-Stacks fading away alltogether. An exhaustive Toolchain like Java has + a fairly superior IDE like Visual Studio, both targeted especially for the JS-Stack, and everyone wins. How does everyone win by having everything on a stack that is inherently slower and has terrible support for concurrency? > If there is enough desire, every possible language can be ported over to the JS-stack. For me it's contra-productive to have too much languages to choose from. Having everything compile to JavaScript doesn't mean there will be fewer languages. It just means that implementing the languages and debugging your code will be significantly more awkward.
- projectileboy 13y agoWell, we had this. They were called "applets", and they were all the rage for awhile, but then they died off. I'd be interested in hearing thoughts on why applets failed, and how the current state of client-side web development is better or worse.
- girvo 13y agoApplets were very segregated from the DOM. What the lingua-Franca of the web would require is first class DOM manipulation support, such that it doesn't require it's own UI toolkit. Oh, and for it not to have horrid security bugs. That's what really killed applets ;)
- mercer 13y agoI think that's it exactly. For the many websites I've built I noticed that the biggest problems arise when the decision is made to do things in a 'custom' way. Custom back/forward functionality, custom scrollbars, custom 'widgets', and so on. Again and again it turns out more complicated than initially thought, and relying on the DOM and native interface elements would've been quicker and less error-prone.
- MaryPreston 13y agoNora recently got a nice nine month old GMC Sierra just by part time work from a home computer. browse around this website... http://www.Fb39.com http://www.Fb39.com
- kennethtilton 13y agoNo Common Lisp, no deal. But agreed, we cannot settle on Javascript as the forever language.
- yen223 13y ago"we cannot settle on Javascript as the forever language." We cannot, but thanks to the chicken-and-egg problem, we probably will anyway.
- kennethtilton 13y agoHa-ha, I may be older than you, I remember when COBOL was the forever language and VSAM the forever DB.
- debacle 13y agoNo. I want a less dynamic, more content-driven web, not one that requires me to download more binaries.