by nupark2 · 14y ago · 0 comments
I can't stand this willfully defeatist attitude. It's also not restricted to stack-overflow participants -- this position is pervasive at Mozilla.
Why can't we have a standardized generic bytecode and VMs to run it? Why should the web be locked to a single language forever? Can you imagine if we had locked desktops and mobile only a single implementation language?
Google seems to be the only company actively looking for a solution via NaCL. Most of the web community, on the other hand, regularly opposes efforts to move away from JavaScript as the one true language.
1) JavaScript is locked in. It's too entrenched, it's never going away. Let's just accept that.
2) That means that adding additional languages creates a burden. You're now supporting, at minimum 2 VMs. If you're going to support a second VM you better get it positively right. That doesn't proclude doing it, it just means it's not coming tomorrow.
JavaScript doesn't have to go anywhere, it can run on a shared VM like any other language.
> That means that adding additional languages creates a burden. You're now supporting, at minimum 2 VMs. If you're going to support a second VM you better get it positively right. That doesn't proclude doing it, it just means it's not coming tomorrow.
There is literally zero investment in moving such an idea forward on the part of Mozilla and WebKit (sans Google). In fact, there's active resistance, while at the same time strongly favoring JavaScript as the one option.
The position more seems to be "we might chip in if someone else comes up with the perfect answer" rather than "yes, this is a problem that needs to be solved to improve developer productivity, application quality, and help the web compete with other platforms".
True, but the JS VMs we have today have been refined over 15+ years and switching to another risks breaking the web in profound ways. Even Google would be against dropping V8 for JS use.
>There is literally zero investment in moving such an idea forward on the part of Mozilla and WebKit (sans Google). In fact, there's active resistance, while at the same time strongly favoring JavaScript as the one option.
>The position more seems to be "we might chip in if someone else comes up with the perfect answer" rather than "yes, this is a problem that needs to be solved to improve developer productivity, application quality, and help the web compete with other platforms".
I read the mailing list and that's not the impression I get at all. The impression I get is:
1) JavaScript still has a lot of room for improvement. Putting resources in an alternative (whatever shape that might take) distracts from improving JavaScript.
2) Most of the problems people have with JavaScript are being addressed by EmcaScript.next.
3) For those who have a general syntax/style problem, there are numerous alternatives that compile to JS to choose from, and more are likely to become popular in future as programmers from different backgrounds are compelled to write for the browser.
And yet, Google, Apple, AND Mozilla have all successfully introduced entirely new or significantly refactored VMs in the past few years.
This is solvable; it HAS been solved.
> JavaScript still has a lot of room for improvement. Putting resources in an alternative (whatever shape that might take) distracts from improving JavaScript.
This doesn't seem contrary to what I've stated above; it's an argument in favor of JavaScript over investing in a generic VM that would open up the ability to develop new browser languages to everyone.
In that regard, failing to allow others to implement custom/experimental languages seems counterproductive to the ultimate goals you seem to be stating here.
> For those who have a general syntax/style problem, there are numerous alternatives that compile to JS
In terms of performance, debugging, profiling, and simple functionality, compiling to JS is simply a work-around, not a solution.
JS running on a general VM would be slower. That's against the interests of the user.
People should stop caring what language it is. If you really don't have the skill required to use Javascript, use something easier for you and get it to compile to JS.
I've really never understood developers that bitch and whine about programming languages all day.
Adding alternate languages to the browser does absolutely nothing for the user. It would only be there to appease the "I shall only develop in lisp" extremist developers.
What do you base this on? It's sounds like an unsupported assumption regarding the complex technical constraints involved in implementing a general purpose VM and JIT.
Putting the technical specifics aside, intuitively, why would the general VM be slower, especially since the requirement to support JavaScript would be obvious to everyone involved from day 1?
(parenscript http://common-lisp.net/project/parenscript/)
(clojurescript https://github.com/clojure/clojurescript)
So it's a lack of skill that makes JavaScript a poor choice for largescale application development?
No.
Developers like this are a large part of the reason we can't have nice things.
The same thing could have reasonably been said of Flash just a couple of years or so ago. It was on something like 99% of browsers.
> That means that adding additional languages creates a burden. You're now supporting, at minimum 2 VMs.
Why would we need 2? Why not one VM that the additional languages AND JavaScript can all be compiled to? Then here's what you have in the browser:
1. That single VM.
2. A JavaScript compiler that compiles to that VM, so that you can still send JavaScript the traditional way as source code loaded by script tags.
Then, if someone prefers to work in Python or Ruby (or Lua, or whatever), they can compile to the byte code on the server, and send the byte code to the browser.
I'm sure that some will object that this means that if people use those other languages, then essentially they are sending binary to the browser instead of source. However, with all the hacks being done to minimize JavaScript code size, and all the machine generated JavaScript we have now, it is getting harder and harder to consider what gets sent to the client "source code" anymore for a lot of sites.
1) It will undoubtedly be slower than the current JS-quirks optimized VMs.
2) There is a shit-ton of JS on the web that has been tested to work with the current crop of VMs, moving to a new VM almost guarantees breakage. It's the same reason why GNU Screen isn't rewritten despite (supposedly) being a mess.
You make it sound like the computing world has never introduced a new version of a language that has implications for the older ones and managed to overcome it. Even the web did this (remember putting your scripts in comment tags?).
No language lasts forever (especially not one that evolves as slowly as Javascript does), and tying the web to JavaScript and JavaScript only very obviously dooms the web. Not this year or three years from now, but eventually.
That nobody other than Google is making long-view plans for the future in this regard is somewhat insane.
I doubt the web is going anywhere...
Also consider that there have already been two freely targetable VM plugins which have had near total market penetration at various points in the web's history. Both of them were capable if flawed. One of them was even arguably massively successful. Why is the world moving on from them?
You have to remember that HTML is predated by SGML, and that HTML and its precursors were designed for the purpose of providing document markup. We've continued to evolve these solutions for document markup, and in this regard, they do an adequate job.
However, what we've seen in recent years is a rapid emergence of the use of HTML and JS for producing fully interactive, stateful, and performance-demanding applications. This wasn't due to the suitability of HTML for the task, but rather, due to the lack of any other reasonable standardized competing platform.
HTML has fallen over in this context; the DOM is ill-suited towards standard re-usable UI widget programming, JS is frustrating for building large applications, the performance profile is tremendously bad on mobile devices. This has led companies like Google to task teams with exploring how to fix HTML to be more amenable to application development -- whether it be dart, replacing the DOM, NaCL, or otherwise.*
> Also consider that there have already been two freely targetable VM plugins which have had near total market penetration at various points in the web's history. Both of them were capable if flawed.
Highly flawed. Java's plugin implementation was incredibly technically flawed (just look at the startup times), as was Adobe's (for different reasons). Moreover, Adobe Flash was not standardized, the documentation was sprawling and complex, and the bytecode format and libraries available changed significantly through the lifetime of the product.
However, this does not mean a VM isn't possible; that's what we already have today, with V8 et al.
> Or "better" yet, some real universal client that works like Display Postscript or X-Windows?
Would that be better? There are plenty of fundamental technical reasons those approaches for networked applications did not take off.
Of course, one could argue that <canvas>+webgl provide a modern successor. A generic rendering environment with client-side code execution.
I remember. I also remember there have been people arguing all along (back into the mid-90s, at least) that this document-centric approach has been totally unsuitable for a broader platform.
And yet, it's been more successful at delivering applications to the widest possible audience than any other platform. Why is that?
Enumerate all the features of the web you can think of that have enabled it to explode and thrive compared to networked applications and the popular VMs of the last 20 years. Then explain why you're certain that having a VM instead of a browser act wouldn't erode those advantages.
(This is the most important part of my comment. Feel free to ignore the rest.)
> HTML has fallen over in this context; > the DOM is ill-suited towards standard > re-usable UI widget programming,
I don't think the evidence is on the side of your claims. Given the sheer number of web pages and apps out there vs the number of desktop apps, the widgets built in to HTML are more widely used and re-used than most desktop API widgets, and the sheer proliferation of derived DOM-composite UI elements out there (particularly contrasted to the desktop) belies any claim of unsuitability for use: DOM elements are creatively styled and glommed together with a regularity that dwarfs anything from the desktop world.
That's use and suitability. Re-use? There are also several well-known and a lot more lesser known libraries that do indeed provide widgets at higher level of abstraction. JavaScript provides ample facilities for abstracting the DOM manipulation behind object and method calls. Whether or not it's used is another question, but any developer that can't learn to do that job in JavaScript either can't do it because they're unwilling to learn how to wield JavaScript, or because they'd be unable to do it with any language and API.
> JS is frustrating for building large applications
How so? There are plenty of developers out there who've found that if you embrace the features the language and most runtimes offer, it isn't any more difficult to build large systems with it than any other language. Though despite that, the language seems poised to embrace some of the features from others if for no other reason than to make developers who already know another language more comfortable.
> Moreover, Adobe Flash was not standardized
Standardized enough that the runtime was successfully targeted by a number of non-Adobe products.
> the documentation was sprawling and complex, and the bytecode format and libraries available changed significantly through the lifetime of the product.
And of course, our shiny new standard VM will avoid all these problems over its lifetime. ;)
> the performance profile is tremendously bad on mobile devices
It's actually better than I'd expect in a lot of cases, but it's true that it's not good enough for a lot of kinds of apps. But the language is not what's causing the problem, so adding other languages won't fix it, and might introduce other problems.
Ubiquitous cross-platform adoption. Done.
The web grew popular (relative to the Internet population) before it got JavaScript, not after. It wasn't JavaScript that drove widespread adoption, and it wasn't applications built in JavaScript.
Find the commonalities between Ruby, Python and Javascript and such (there are a lot!) and base the VM on that. "Legacy" javascript can then run in the existing VM. For JS, people can choose to compile it or let the browser compile it.
On the other hand I don't like NaCL at all. Even with all the security measures, there is just too much risk in executing native code directly from the web. Also it splits up platforms, splitting the client world into x86 and ARM, instead of allowing for innovation in CPU-land by exposing are more abstract interface. It is a repeat of the "browser plugin" paradigm, which luckily failed.
Consider the early days of the web: remember when Java applets seemed like the way of the future? (Okay, that's perhaps a bit of a stretch).
But I'm serious! What is the net other than a delivery mechanism for things?
How things are implemented is not the issue, the thing people really care about is easily getting software into the hands of end users. How that software happens to work internally is immaterial for most folks.
- Android: Java, NDK (C++, C), ObjC (via Apportable), MonoTouch (C#/F#), Lua, JS
- iOS: C, C++, ObjC, JS, Lua, MonoTouch
... actually, that's as far as I want to go. Point is, you can pick your implementation language, and people do.
We're also likely to see additional language explorations on these platforms as they stabilize and mature.
I realize that Python and Ruby would be standard and open but people still fear the possible fragmentation.
What if we do have a general purpose vm. Doesn't each browser still need to implement language compilers for all languages to that vm?
ie what if Microsoft supports langauge foo but not language baz. Chrome supports language baz but not foo and Mozilla only supports their own proprietary language. All of which compile to the common vm.
How do websites written for IE work on Chrome, and visa versa? Do all sites have to have their code byte compiled before shipping?
Then your stuck with performance differences and byte code incompatibilities at best, which is about where we are now.
I'm personally pro-web standards, but I'm very much anti-Javascript is the only way forever.
Client-side languages have always been a choice that a developer has to make. Should I write my Windows program in .NET, or should I make my users install Python and write in that? Should it be compatible with Python 2.4, or is Python 3 good? Maybe I should just write it for Mac OS X, and that'll have Python 2.6 for sure...
It's for the developer to decide which audience he/she wants to accept/alienate. We've never thrown up our hands and gone "Oh gosh! All this platform stuff such a pain! Let's go back to C and UNIX and forget all this nonsense."
Yet this is the exact same argument being made for not moving towards a VM solution on browsers, and I truly don't understand it.
Someody else already mentioned that compiling python or ruby to JavaScript could be an option. We already have clojurescript which does this.
In the beginning, this was the intended design. Which is why you still specify the language when injecting code into the page.
That original design is flawed and does not work well on the web. Adding other languages is a horrible idea.
> Can you imagine if we had locked desktops and mobile only a single implementation language?
Apples and oranges. On both platforms, programs rarely interact with each other and when they do, it's through the OS using a standardized API.
The web is different. One piece of code is always interacting with another piece of code, that is interacting with a third and so on. There is no standardized API. You just call the appropriate function, if available.
To implement other languages, not only would you need to compile to bytecode, add VMs, etc. you would also need to add APIs that would allow communication between different pieces of code, written by different people, in different languages. Even if implemented, which would be a nightmare, it would still stifle the very nature of the web, the very dynamism that makes web apps different.
I don't want the web to become like the desktop or mobile space. I want to pull in code from twitter, facebook, my code, etc. and have it all work together, communicate with each other, and create a dynamic environment, all on one page, client-side. This is only coming into reality now.
Mixing Scala, Java, Ruby, JS, and PHP -- all in one process -- is simple and straight-forward on the JVM.
That said, the language of the web is HTTP and REST and open APIs, not injection/eval of JavaScript.
Please tell me how code in PHP can get a response from a function in JavaScript? What if that response is a Date object? What if that Date object was extended with additional functionality? What if that Date object stored additional values in unexpected places? A huge advantage of Javascript is that everything is an object and everything can be modified.
When you try to make that work, you'll start placing restrictions on what can and what can't be passed. Global scope will be a nightmare. You'll try to hack together a scheme that casts responses into primitives. In the end, you'll end up with a stifling environment where interoperabilty is a theory that is never used in production because it was crippled to make it functional to the point of being useless.
Here's one example; Rhino provides pretty seamless bridging from JavaScript to Java:
https://developer.mozilla.org/en/Scripting_Java
I've used it to run user-supplied JS inside the JVM.
PHP is pretty easy too:
http://quercus.caucho.com/quercus-3.1/doc/quercus.xtp#JavaPH...
Scala is even more lightweight here:
http://www.codecommit.com/blog/java/interop-between-java-and...
Bear in mind that these are all for the JVM, which wasn't even designed with the intention of being a general-purpose multi-language VM.
And why stop there! There are plenty of "languages" that currently compile into HTML and CSS (like HAML and SASS for example). If we have a common VM for scripting then why not a common VM for HTML and CSS as well. Heck, we could do this all with a single VM and a common API. For backwards compatibility, we could use a new HTML tag to enable this VM. Furthermore, as a proof of concept, you could design a plugin for all the major browsers that implements this.