Not that you asked, or that you care, but I think somebody needs to post a wish list for AS4 as far as the language construct is concerned. AS3, being a huge step away from scripting and into the world of development, was kind of like man’s first steps on the moon. We did it, now what? It’s time to colonize, conquer, dominate, install weapons systems… now that the moon is ours
Anyways, what I’m saying is that AS3 was a deep jump into uncharted territory for most of us in the Flash community and many of us ran dizzily in circles at the release of something so foreign to the Flash Platform (and many of us still are). Now that enough of us have made the jump from scripting to developing, I believe Adobe needs to “solid up” Flash Player with more Java-like constructs. I mean, AS3 is supposed to be an object-oriented language, yet we don’t have abstract methods, abstract classes, and a few general OOP must-haves. Yes, we can create semi-abstract classes by naming conventions and by throwing errors by hand, but come on! Nobody likes to develop abstract classes in AS3, though they’re pretty much a necessity in true OOP.
I digress, there’s just so much on my mind. I’ll now get started on what this post is really about, AS4 and what we need from it.
- Language Addition – Generics:
Generics, or parameterized types, are one of the coolest things to ever happen. Even Flash Player 10 is going to support some form of generics through the Vector type. Adobe has noted that when using the Vector over an Array, there is a 40%+ performance increase. Though we now, or soon, have this kewl ‘generic-ish’ type, we’re only seeing the tip of the iceberg. We need a “java.collections.*” equivalent for Flash Player. The Java Collection implementations are some of the coolest thing in all languages, allowing for extremely efficient and simple manipulation of groups of values. It also forces even greater strict-typing, rather than the Array and Object classes. While I totally understand the need to have intrisnic classes like Object and Array, we greatly sacrifice type-saftey with them. A collections API would eliminate the lack of type-safety within Flash Player for the most part. If we don’t see this in AS4, we have every reason to be upset. I also feel the need to mention this: though FP10 has Vector<Object>, there are no means by which to develop your own parameterized types as in Java. Now, I don’t know of too many developers that create their own parameterized types just for kicks, and I myself have never had the need to create my own generic class, but we need this ability. Who knows, somebody in the community could come up with something extremely useful in a generics class, maybe for a 3D engine or a framework.
- Language Addition – Abstract Classes/Methods
WE NEED ABSTRACT CLASSES! As an OOP/Design Pattern enthusiast, I am really feeling the need for abstract types. I can’t vouch for performance or any other benefits to abstract classes, but in design patterns, abstract classes are key. As it stands in AS3, the creation of abstract types is pretty limited. There are workarounds to doing it, of course, but still. We greatly need abstract types. Even if it won’t affect you on a day to day basis as a developer, this is core to an OOP language.
- Language Addition – Memory Management
Now I’m no C/C++ guy (yet) but AS3 and FP9 definitely have some problems with memory management that make it excruciatingly difficult to manage memory, make sure objects are REALLY deleted, etc. I know that AS3, like Java, run off of a VM and have a garbage collector, and by definition, the VM should take care of itself. However, that doesn’t mean memory optimization has to be painful if not a downright nightmare as it is currently! I don’t know how it would work or what exactly to suggest that Adobe should do, but we need some tools to track event listeners and object references, as well as add a finalize() method to the Object class and its descendants as per Java. The event system in FP should be optimized to be weaker as well. *Note: Yes, I know about the useWeakReference field in addEventListener. I nearly always set it to true, and yet I have noticed that some objects simply won’t let go and be destroyed.
- Language Addition – Annotations
Yeah, FP does have compiler meta-tags, but we as developers should be able to develop our own. I mean, Flex is a framework right? A framework should basically just run off of a platform and have no special requirements, yet Flex requires a special unique compiler and defines its own meta tags such as [Bindable]. If Flex can bind data that easily, why can’t we do it in strict AS3 without the Flex compiler?
- Player Standard – Ubiquity
With the advent of FP10, we now have a bunch of GPU effects, Pixel Bender, 3D drawTriangles functionality, etc. However, these features are only supported on certain processors with certain graphics cards. Isn’t the purpose of Flash to provide a platform-independent runtime? This sounds an awful lot like Adobe is pushing Flash away from being the same on every OS and configuration to being a specialty runtime for certain CPUs and GPUs. This doesn’t make any sense, why enable a feature that’s not consistent on every computer? How do we use Pixel Bender? How do we know our target audience will have X processor and Y video card? Does anyone else see the problem in this?
- API Rework – Text API
The flash.text package serves as a great starting point, but definitely leaves one wanting for more. The HTML reading capabilities of Flash Player have always been pretty weak. I think that Flash Player should have default support for reading all standard HTML tags the way that a browser would read them. What I’m hinting at is cross HTML/FP tag reading. If <img> does one thing in a browser, it should do the same thing in Flash. In FP9, <img> inserts a new Loader object with the url ready to load, but it inserts it on a new line. In a browser, this isn’t so, it only puts it on a new line if necessary. I’ve built a few chat applications where I had to use smilies and this makes it a nightmare. Whenever a user inserts a smiley, it automatically puts it on a new line. Text-wrapping around images has also been problematic.
Well, these are just a few things I’d love to see in AS4. Oh, by the way, does anyone know the status on AS4? I know that Tamarin was abandoned by Mozilla, but do we know what Adobe’s up to? FP10 is being released soon and we’re all stoked about it, but there is definitely a future for Flash beyond 10, and we should start pushing for features now rather than later!