ActionScript and ECMAScript 3.1/4 – Inter-op is the Key

Like many other Flash devs I’ve been following the discussions surrounding the ECMAScript 4 decisions and the Harmony project quite closely. There are a few bloggers out there that appear to be stating that ActionScript will become divorced from the stan…

Like many other Flash devs I’ve been following the discussions surrounding the ECMAScript 4 decisions and the Harmony project quite closely. There are a few bloggers out there that appear to be stating that ActionScript will become divorced from the standards. To be honest only Adobe can decide that, but either way, that’s only half the story. In particular, it does not mean that ActionScript will not be able to inter-op, and that’s key…

Here’s a Google Spreadsheet containing the votes by Adobe, Mozilla, Google, Apple and most controversially Microsoft regarding the various features of ECMAScript 4, such as the notion of packages, new operators, and so on. So clearly everyone not in agreement, everyone with their own valid opinions and vested interests. And you can see already that there are rejections in the feature set of ECMA4 that AS3 has already implemented.

So does ActionScript 4 have to take a side step (and maybe a step backwards) to get in line? It doesn’t really matter. Whilst it’s nice to be able to jump between languages without having to change your mindset at all, it’s not a big deal. What is essential is that you can call functions and pass objects between those two VMs, or indeed, share the VM. And forgive me if I simply don’t understand enough about how this sort of thing works (very likely), but this is still possible.

Indeed right now we can very easily inter-op between the very old JavaScript 1.5 and ActionScript 3 via ExternalInterface. Yes there are limitations, but both environments (Flash and HTML) have many unique features and extensions that simply don’t cross the boundary very well. For example the HTML DOM (having said that you can still control it, see AIR), or in the case of Flash, cutting edge features like 3D, Adobe Pixel Bender (Hydra), or even simple Bitmap effects. Now I know these are not language features at all, but they are part and parcel with how we as developers use our language every day, and so there is no harm at all in having extensions that are unique to one environment, as long as they do not conflict with a similar feature of another. One example here is packages and namespaces… AS3 has them, it doesn’t look like JS will get them, but so what, as long as the code is similar enough to understand, porting code can be automated, and at the very least inter-op can still be easily achieved the fact that they differ is small fry.

Personally I would say the challenge now for Adobe will be to continue to develop ActionScript into a feature-rich language, whilst making sure it doesn’t begin to conflict with the ECMAScript standard it runs in parallel to. The nature of JavaScript following the committee-led ECMAScript standard means this is going to happen again and again, the process is simply too slow. Adobe (and now Microsoft) have set a new pace for the web.

I don’t know, I think it’s important that the web have a standard. That’s the natural progression, just because in 2008 people don’t think that namespaces and packages are applicable doesn’t mean by 2009/2010, when the spec was scheduled to finish and be shipped in products, that these features won’t be useful. We’re looking for a standard that will last the web for years and years. Javascript, Actionscript, etc need to use the same principals and code. It’ll make learning the languages easier and ultimately lead to better web based products in the future.

I agree with Rich on this one. Whilst moving towards a common standard is the right thing to do, it should not be at the cost of unique or existing advanced or helpful functionality. Look what they did to the Singleton by preventing private constructors in order to adhere to a standard. I really don’t believe we should have to take a blanket step backwards to move some things forwards.