ECMAScript 4 - strongly typed?

| No Comments

I just came across this link today (a week and a half late). ECMAScript 4 Netscape Proposal. One of the interesting things that jumped out at me is the typing of variables.

Flash ActionScript, an ECMA-262 language, is not typed. That is to say, declaring a variable and assinging it a new type does not yeild syntax errors, unlike some other common languages (Java, C++, etc).

var x = 1;
x = "new value";

... is perfectly legal. But, if the proposal is accepted, you would in theory be able to declare variables like this...

var x:MyType = new MyType();
x.foo();
// the above is the same as this...
var x = new MyType();
x.foo();

I say in theory, because there is no guarantee that ActionScript would be updated if a new standard was put into place. Actually, this is a big deal with ActionScript because the Flash 4 way of accessing variables is by using a colon...

_root.ball:color = red;

This is a big deal because currently the Flash player can play all previous versions of Flash content. If ActionScript becomes typed like in the new ECMAScript proposal, that would mean that Flash 4 movies would break. This would require multiple players to be installed on a computer to view all possible Flash content available. Either that, or everyone would be forced to update their old content to at least Flash 5 dot notation. There are probably some other options too, but I can't think of anything else off the top of my head.

This is a big deal again, because Flash 4 syntax is FAST. When creating games, I revert to Flash 4 style code because of great performance advantages, even though the coding style is deprecated (not to mention hard to read).

Anyway, this will be really interesting following along. Isn't it about time for Flash 7 yet anyway? I'm curious of the course Macromedia is going to take...

In the meantime, check out Peter's blog for an entry about strong-typing with Actionscript.

Leave a comment



About this Entry

This page contains a single entry by darron published on July 9, 2003 5:38 PM.

SharpFlash, under the hood was the previous entry in this blog.

SWFHeaderInfo 1.1 is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Archives

OpenID accepted here Learn more about OpenID
Powered by Movable Type 5.02