Calendar

March 2017
Mo Tu We Th Fr Sa Su
<< >>
12345
6789101112
13141516171819
20212223242526
2728293031

Langs

ECMAScript 4 and the web

Posted on Nov 03 2007

Recently was published a proposal for extending the current Javascript language with a good set of new features : classes, optional type system, and a lot more. This proposal is known as EcmaScript4 (ES4) and was built by the TG1 discussion group composed of representatives from Mozilla, Adobe, Opera, Microsoft, and maybe a few others.

While things were going smoothly up to now, there is currently a quite big debate among some of the TG1 participants and other people from the Javascript (JS) community (see the whole public discussion if you have free time).

Why this may seem a bit technical, it can have a lot of impact of our (web developers) life.

Stakes

At first, and in order to understand the situation we are in, there are different kind of conflicting interests at stake, so let's try to sumup a little bit :

  • Mozilla is pushing for big changes : they are big users of Javascript : a lot of their applications are scripted with JS, they have XUL, ... More language features would help them in their everyday work. And surely they would be happy if ES4 would become the standard for web development.
  • Adobe fully supports Mozilla in this push for ES4. For some time now, they are targeting developers with their new products and want people to forget about the whole "proprietary platform" label that is stick to Flash. Their strategy is then to support a standardized language. They already implemented a reduced ES4 version called ActionScript3 and the Virtual Machine that runs it (Tamarin) has been donated... to Mozilla.
  • On the other side, this is exactly what Microsoft is fearing : they have been investing a lot of time and money into their own proprietary technologies, like C# and more recently released Silverlight which is seen as a Flash competitor. They would not like to see a new language that they don't control, that was designed by an alliance of their competitors, and that (horror) doesn't run yet on .NET
  • there are fears that ES4 would "break the web" since it seems that Mozilla want to replace current Firefox JS Virtual Machine (SpiderMonkey) with a new one that would run ES4. ES4 is is supposed to be backward compatible with JS, but when you change implementation, you might get some bugs and incompatibilities anyway, since even with a lot of testing, software is rarely perfect.
  • there are others comments for people of the embedding browser market, such as Opera. For obvious reasons, their fears are more about the size of the runtime that would be needed to run ES4, memory consumption etc.
  • some JS developers prefer small-steps improvements to one big-step one. For several reasons. One is be pure conservatism, the other is that when your daily technology evolves, you feel huge pressure to keep up-to-date with the latest features. And if you read ES4 proposal, you can see that while you can write plain'old JS, the number of new features to learn is huge, and it would take a lot of time for the average JS programmer to master the language.

I hope that I didn't forget anyone opinion, I didn't include technical discussions about the usefulness of ES4 features but with that many different point of view it seems already quite complicated.

From here, what ?

As we see, each party has more or less its own internal agenda, which is perfectly normal in an human world. But at this point, the situation is pretty blocked.

Mozilla and Adobe seems to want to push ES4 up to the end, and Microsoft will not accept it. I personally don't care about Microsoft opinion EXCEPT that they are the ones doing Internet Explorer (IE), you know, that (still) 80% market share internet browser, the one your users are visiting your website with...

So, as developers, we're out of luck.

Mozilla and Adobe thought the same and came up with the ScreamingMonkey project, which is an ES4 runtime that can be installed for Internet Explorer. Nice, but how long will that work ? Given that Microsoft has no intention of helping, I can foresee that each IE/Windows update will break something. In short : I'm not sure it's possible in the long term to put a plugin into an application while its owner does not want to hear about it !

So, as developers, we're out of luck....

Another solution ?

Now, I'll take a bit of time to write about my own (not hidden) agenda.

Haxe is a high level programming language that has been developed for few years now and which has a still small but growing community of users. One of the particularity of Haxe is that it can compiles to Javascript. It means that you get all the benefits :

  • you are using an high level language with compile-time static typing
  • the Haxe language let you also do dynamic stuff that is helpful for DOM/AJAX implementations
  • in the end, you are generating a .js that can be run by all current browsers
  • it's open source
  • it can interoperate with existing JS libraries
  • if you don't like it, simply use Javascript !

<irony>

So my suggestion to Mozilla and Adobe would be to drop ES4 and use Haxe instead :) There's already an open source compiler available, and a Book on the language should be published soon... unless of course Haxe features are not good enough, but I'm open to suggestions and discussions on this particular topic.

</irony>

And developers ?

More seriously, it's a shame that nobody asks to the main people concerned by such a decision what would they like to have. The main people here being web/JS developers, which as far as I know are not represented in the ES4 committee.

That's actually one of the big problem I have with ECMA or W3C. Everything is decided by a group of people that represent corporate interests, then they publish a huge document which is often a bloated specification that only big companies with enough cash can afford to implement.

What was useful a few years ago in order to ensure intercompability between different proprietary vendors is no longer needed when there is one single open source implementation.

That does not remove the need for a clear specification that needs to be either respected or modified, but at least that gives additional agility in the process of designing this specification.

As a language designer, I prefer to experiment long time with a feature, then if it was useful for enough people of the community, it's added to the language. If not it's removed. That's the way software should be designed, at least IMHO.

Conclusion

So what would be wise to do now that we're here ? My suggestion would be to forget about languages, forget about syntax or features, forget about corporate wars (if possible).

What are the problems with current Javascript ? As for me they are :

  • browser apis incompatibilities
  • security
  • speed (slow)

So why not have every browser vendor sit around the table and resolve first these issues that are the ones really concerning the developers, instead of losing their time and energy in these fights ? Then, as for improving the language, I think it would be better if it was a community work, since corporations can fight between them but no one has the interest to fight against the developers community.

0 comment
Name : Email : Website : Message :