If it was necessary to compile it ahead of time (AOT), there simply wouldn't be any inline JS.
Very much so. But you still could compile it to bytecode, the way Java and ActionScript work.Even if you relagated it exclusively to .js files (the "unobtrusive" approach), using code that was compiled into asm for the browser would be an assbackward approach.
No, it wouldn't be. All interpreters I know parse the entire file ahead of time anyway, so they pick up all syntax errors except those in late-interpreted strings (e.g. eval()). And just because you compile it first doesn't mean you have a static type system, which is the other place where you can catch bugs. I don't see what other advantage AOT compilation could have.Also, javascript would be much easier to debug if it were compiled first,
Edit. Reload. Try again. The fact that there is no separate compile step makes it a lot easier. The fact that I can enter stuff in the error console, or even the URL bar, makes it a lot easier. And if necessary I can even go down to the command line JS interpreter, as long as my script isn't about DOM interaction. There's Firebug and similar tools. They are not in the least hindered by JS's usually interpreted nature.so this idea that the interpreter makes "the edit-try-repeat cycle" easier is also assbackward, at least in the case of js.
Another place where I don't see interpreted vs compiled making any difference.Altho to be fair, I think error handling is better in most interpreted languages (as opposed to compiled ones), so your point is valid.
That's got nothing to do with being compiled. That's about the nature of the Flash plug-in. It doesn't expose the DOM of the browser, only of its own content. Therefore, ActionScript can mostly only interact with the Flash content."Flash" code is compiled into bytecode, but witness flash lacks javascript's potential for page interaction (except to the extent that it uses external js).
The key point is that interpretation vs compilation is a matter of the implementation, not of the language. There's a C interpreter. (More than one, actually.) There's even a C++ interpreter used at CERN, but I don't know how good it is.
On the flip side, every now and then somebody writes an AOT compiler for various previously interpreted languages.
As a matter of fact, there are hardly any straight interpreters left. Show me one significant interpreter that doesn't first parse the source code into some kind of bytecode (and possibly caches it, as CPython does) and interprets, or even JIT-compiles that. Significant JITters of previously interpreted languages are, for example, TraceMonkey (JavaScript, Mozilla), V5 (JavaScript, Google), SquirrelFish Extreme (JavaScript, Apple), and Unladen Swallow (Python, still in alpha). Flash 10, I think, was the first Flash version that JITted ActionScript. (The JIT engine of Flash formed the base for TraceMonkey.)