Three Months of ActionScript

Published:

I've been working largely in ActionScript 3 for the past three months. After spending four years working primarily in JavaScript I didn't expect to encounter too many problems with her cousin. That expectation was pretty well borne out.

I was particularly excited at the chance to play with ActionScript's optional strict typing since that has been under consideration for future versions of JavaScript / ECMAScript. AS3's strict typing hasn't felt optional to me because I've been largely using the Flex Builder IDE and it excitedly warns me every time I fail to specify a type on a variable or function signature, so I put them everywhere. Instead of implementing encapsulation using conventions like I do in JS I use AS3's Interfaces. This felt good at first but I quickly realized that I couldn't do the kinds of tricks that I'd become accustomed to in JS. I can't create a typed object in a function and return it without defining a class for it in its own file. This has made the higher level structure of my software far closer to Java than to JavaScript.

On the other hand, inside my functions I'm pretty much writing JavaScript. All of the standard JS built-in objects (Object, Array, Math, etc) behave like modern JS implementations. I use anonymous functions to manipulate and filter arrays. I use Objects and Arrays as my primary data structures.

At this point I'm pretty used to AS3. I know how to design my code and I can be pretty productive, not needing to rewrite everything too many times. I'd like to see Adobe mix the Java-style classes and interfaces up with the JavaScript habit of declaring anonymous functions and objects as you go. I'd be thrilled if I could write something like: var x : IMyInterface = new IMyInterface { method: function() : void { ... }, field: 42 };

I see that they're extending the language to support limited generics support so hopefully that won't be the end of it. I'm looking forward to experimenting more on the platform.