Last Wednesday Adobe released their roadmap for Flash. I highly suggest all Flash developers check it out. This document mentions “Actionscript Next” which we all know means “Actionscript 4″.
I actually started hearing about as4 back in October at the Adobe Max Conference. I won’t name names because I don’t want to get anyone in trouble, but several of the top names in Flash and at Adobe casually mentioned the possibility of an as4 in semi-joking. Once I’d heard it 3 times in 3 different presentations I was convinced. So, I’ve been contemplating what as4 could be ever since. So I thought I’d write a bit here note what the whitepaper says and what I hope as4 has.
Here’s what the whitepaper says:
Stringent static typing as default, with optional dynamic typing: Most stretches of most programs are expected to benefit from static typing. However, ActionScript 3 tends to lapse into dynamic typing all too easily in places where absolutely stringent static typing would be preferable. This will be corrected. Dynamic typing will still be available when needed, but it will no longer be the default for ActionScript, and it will need to be enabled explicitly.
Type inference: Type declarations will only be necessary in certain strategic places. Everywhere else the compiler will automatically infer suitable type declarations and treat the whole program as statically typed, even though the programmer does not have to state any types. Thus the convenience of untyped programming can be approximated quite well, while providing the performance advantages of typed programming.
Hardware-oriented numeric types: For example, int, uint, float, float4, byte, short, long, etc. (the exact set of types is still under discussion). Currently in ActionScript 3 integer values can overflow into floating point values. This will be changed so that numeric operations will never change the underlying representation of the numeric. We foresee this addition greatly reducing implementation complexity and improving runtime performance.
Stringent typing only matters if it means there is work being done in flash’s memory system to take advantage of it. I’m going to hope that this work is being done. Honestly I’m a little worried about the devs at Adobe fully getting this. I was attending a presentation at Adobe Max where the presenter was explaining the concept of an object queue and how that can increase performance. However, he used the new typed Vector class and was continually pushing and popping out of it. I thought to myself, well that seems dumb. So after the class I asked him if the memory in Vector was contiguous, it was clear from the look on his face that he had no clue what I was asking. And if you aren’t excited about having float, byte, and long available I don’t know what your problem is.
What do I want (in no particular order)?
Mobile support ready at launch: Mobile AIR is going to revitalize flash in a very big way. As4 better be ready to capitalize on that.
Templates: To be fair I actually don’t care about Templates. I always felt like they only exist to quiz new hires on programming techniques. But new language and strong typing should allow for this.
Destructors: I know, I know – I shouldn’t need it. Well guess what – you ALWAYS NEED IT. The only flash apps I’ve created that didn’t “null out” and manually kill their event listeners were super small insignificant test apps. Making an actual Destructor would be very handy for those of us that don’t trust flash. Speaking of which…
More control over the GC: Chances of getting this is pretty high I think. Adobe has been giving us more and more control over the GC in the past few releases and I only expect this to get better.
Threads: I only mention it so I note that I don’t need to mention it. Threads are on the way for as3.
Function Overloading: Chances of getting this are slim to none unless the wizards at Adobe really change the way memory is handled, but I can dream.
Operator Overriding: I can count on one hand the number of times I’ve wanted this in flash, but I have wanted it so….
Integrated Stage3d Stage3d is great, Stage3d is the future, and Stage3d needs to go away. It is CRITICAL that there be no distinction between non-gpu and gpu based rendering in as4. The compiler should be smart enough to use the gpu when it can without my code having to explicitly call it. I don’t think that’s too much to ask. At least I hope it’s not.
Enums: Yes I know you can code around it, but there simply is no substitute for a good Enum.
Extending Multiple Interfaces: Simple – make it happen.
Well that’s all I can think of at the moment. So in case all this talk got you hot and bothered – don’t be. The earliest anyone could expect tangible info on as4 will be at next year’s Adobe Max and I would be shocked if there was even a demo then. The earliest possible release would be with CS7 which we are 2 years away from. So, until then get you some Starling and rock on.
TLDR: Actionscript4 YAY!!