Can anyone tell me why ActionScript 3, a statically typed language, doesn't have generics? Is it too much work? A historical thing? Is there some way to "fake" it that I haven't picked up yet?
Edit: thanks a lot for the answers! The Vector
class is basically what I was looking for, and the other information was helpful too.
ActionScript is basically a dialect of JavaScript (which is also called ECMAScript). So you can still use it.
While originally designed for Adobe Flash Player, ActionScript 3 may be used by developers today to build plugin-free, cross-platform, web applications with Apache Royale.
ActionScript is very similar to JavaScript, except it is built solely for interacting with Flash applications. These are usually videos or small interactive modules inside web pages. Many of them use Flash.
Classes are external ActionScript files that define objects; they are stored and organized in a specific directory structure in the Flash CS3 program directory (Figure 4.1). To use them in your code, you have to import them.
The new Vector class is a form of generics that Actionscript 3 now supports when compiled for Flash Player 10. They don't support the specification of your own generic classes, yet.
I think Adobe will implement the ES4 standard eventually. It would be nice if they had a competitor who could push them quicker in the right direction. I was expecting a little more from the updates to AS3 when they moved to CS4, but I suppose the revolutionary Vector class will have to suffice.
It looks like they spent a lot of time beefing up the libraries for Flex and AIR, so maybe they'll go back to improving the language support later, but it probably isn't a real priority. Remember, Adobe is in it for the money, not for the feel good of making the sweetest possible language.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With