Things I hate about AS3
After the experience of working on the almost 50,000 line Dragon Age: Journeys project, I’ve been thinking about what I love (and hate) about AS3. It’s really not a bad language, and it’s certainly professional enough to make high quality browser product. So, kudos from making something which looks sort of like Java and has a professional IDE like Flex to boot. But there are quite a few areas which just mystify me, and here’s the list:
Here’s my list of areas that could be improved upon.
- No ability to determine where an SWF was loaded from. If someone embeds a link on their page to my SWF which is hosted on my site, why can’t the SWF determine who is loading it — as opposed to who is hosting it? Sure, I can lock down the SWF on my site, but what if I wanted to have the SWF itself decide whether it could be loaded from an arbitrary domain X, and at runtime do different things?
- No multiple inheritance. Why, Adobe, why? You can implement an interface, and extend a class, but not extend more than one class at once? This would actually be a useful concept to have, even if you can kludgily work around it via aggregation.
- The Flex profiler. Some parts of it aren’t terrible, but why can’t you start and stop sampling via the GUI? Is that not an obviously necessary feature a developer would want? It might take me 5 minutes to play the game far enough to get to a point where I want to sample, and yet it seems to always grab the entire history of the running app.
- Enums. Where the heck are the enums? There are some nifty ways to roll your own via reflection (looking at the XML of the class itself), but come on here, people — this should be a native language feature.
- Block scoping. Anyone that’s tried to write “for (var i : int = 0; i < 10; i++)” more than once in a function knows this pain. What’s the point of even allowing a var declaration inside a for (or other) statement if it’s not going to be scoped to it? You might as well make it a compiler error and force all variables to be declared at the top of the function.
- Integer serialization. You would expect an int to be a 32-bit number, just like every other language in the planet. But the AMF format evidently uses this wacky 29-bit scheme which means your biggest unsigned int is actually 2^29-1.
- Release mode is useless. What’s the point of release mode compiling, if all my variables, symbols, and data can still be inspected in plaintext by any braindead Chinese hacker using off-the-shelf tools?
- Number types. If I write “x = 7″, what is 7? An integer? A double-precision float? Who knows! A rounding and precision nightmare.
December 16, 2009 | Filed Under Uncategorized | Leave a Comment