… stop! I see you there upgrading a dead man (think ECMASscript.next) or even trying to replace it with some backwards compatible gibberish (think Google Dart). Let’s talk first…
So, yes, JavaScript is one hell-of-a pain-in-the-ass language, which is dynamically typed and then again not – think arrays and objects. It’s not OO, but yet you can do it – think anonymous functions and objects or functions within functions, ala funception :). The list might go on, and in overall it’s messy, not that easy to read and not that easy to maintain, not that easy to refactor and not at all easy to extend or build some modular systems, yet it’s specified by ECMAScript. Now JavaScript is not the only language conforming with the ECMAScript specifications, there is one more player on the field, it’s just running in it’s own VM for now and has it’s own community – ActionScript 3.0.
Why can’t you take this beautiful language, with full OOP support, events and anonymous functions and adapt it in to a web browser? I’m not saying you should implement the whole Flash framework as well, just the core classes and the syntax.
How it would conform with the web as we know it, you may ask. Well one of you has already implemented two different languages in one browser – Internet Explorer with VBScript and JScript. It would look like this for starters:
<script type="text/actionscript"> package { import dom.*; class MyClass extends DOMDocument { public function MyClass(){ super(); addEventListener('onload', init); } private function init(e:DOMEvent):void { alert('we\'re done!'); } } } </script>
DOM events, dom classes, Xpath, everything you need to build a web. Built-in objects like: Date, Number, Array – they are already there in JavaScript. Take the syntax, add fully blown OOP, throw in some new classes like Mouse, MultiTouch, Browser (for example, for user agent information) etc. – do it as Macromedia did it when they created version 3 of ActionScript when the previous one was more like JavaScript. This is one of reasons why Flash will not die that soon – it has is it’s very well built language and frameworks (Flash and Flex).
How about performance – AS3 does it that well, because it’s compiled – the answer might lay in cache – do not cache plain source files, cache bytecode, cache compiled source – for faster execution.
And finally – for the love of god, do this thing together. Yes I know I’m trying to ask for the impossible in this corporate world, but then again – you did well with HTML5. 🙂
And again, if you have some pros or cons on this subject, let’s discuss it in comments section.
Sincerely yours,
Gusts