« Write a Book on Flex? | Main | FlexSpy, a New Tool for Design »

Future Features in AS3

After reading Keith Peters' post on singleton's and abstract classes, I wanted to see if there was more public information about the state of abstract classes in ECMAScript 4. As most readers of this blog will know, AS3 will be an implementation of ECMAScript 4, and some of the lack of features in AS3 is related to the state of ECMAScript 4. But that also means that we can peer into the future of AS3 by looking into ECMAScript 4.

I found a bug on bugs.ecmascript.org titled "Private constructors are useful, common, and need to be supported" and marked as Resolved. That's great to read, and it means that someday we'll have a real way to create abstract classes in AS3. (Update: that could be wrong. Read the comments below.) The word "someday" is important here, though, as ECMAScript 4 looks very large, and I doubt anyone knows how long it will take to implement it all.

ecmascript.org has a lot more information to dig through, such as the proposals section of the wiki. There's way too much to read here that's interesting, but here's a few that stood out to me: type parameters, resurrected eval, generic functions, and Meta-object. Just this small snippet of the proposals page includes information on generics, method overriding, and class reflection.

Comments (3)

Jens Halm:

While protected constructors are an important prerequisite for creating abstract classes it looks that they still will not be "real" in ECMA 4. Which means you cannot explicitly declare classes or methods as abstract. I remember that I found a hint that this will definitly not be included with ECMA 4 on the official site.

I think this is a core feature for an object oriented language with interfaces. Especially the template method pattern would be so much nicer to handle if it would be the compiler that would remind you "you have to implement this abstract method" instead of catching a runtime error "This method is abstract" which is quite ugly.

Hi Jens, yep you're right and I read through that bug too quickly. I thought I had read about it working with abstract classes, not to enable it. The bug gives us an easier path for singletons but not abstract classes.

I hope that there's the plan for abstract classes, and I didn't lead people to believe it! I just tried to find a reference and couldn't find anything. I only found some year-old discussion of abstract classes being missing.

A great presentation on the new features in ES4: http://moock.org/lectures/newInECMAScript4/