Tuesday, May 11, 2010

My Most Wanted Flash Features

I've seen a lot of most-wanted-Flash-features articles. So I decided that I might as well write one :p

Full GPU Rendering Support
Currently, Flash Player 10.1 only supports hardware acceleration for the full-screen feature and video playback. I've always wanted to see Flash Player being capable of rendering all the display objects with full GPU acceleration. It'll be a huge boost on the performance. I believe lots of people out there also want this feature very badly.

Function Overloading
ActionScript is the only one among the object-oriented languages I use that does not support function overloading. This can sometimes lead to frustrating experiences while designing frameworks. Sometimes I just want to provide functions with different sets of parameters that do the same job; however, due to Flash's lack of support for function overloading, I have no choice but to use lots of optional wild-card-typed parameters and depend on their types to perform differently in a single function.

Complete Generics Support
The Vector class supports generics. However, I'm talking about COMPLETE generics support. That is, developers are able to write classes with whatever class templates they want, instead of only playing with the little Vector class provided by Adobe.

It is so tempting to write classes with generics. Just imagine if you could write a following generic class:

There'll be no more type casting issues, and the following code is definitely legal.


Data Container Framework
What naturally comes after the generics support shall be a data container framework like that in Java. I hope Adobe can provide a set of containers of basic data structures, such as linked lists, stacks, hash maps, hash sets, etc. Currently the Dictionary class acts like a object-to-object hash map, and is not strongly typed, which requires lots of casting being done. With a generic data container framework, we are able to write code like this:

And it's guaranteed to be type-safe, so you don't have to cast the evaluated value of map["mapSprite"] to Sprite anymore.

I like the Java container framework very much, especially the support for iterators. Iterators make traversing abstract containers even extremely easy and intuitive. I hope Adobe do consider adding a container framework seriously. I know there are already some neat container frameworks out there, like as3ds, but it's always nice to have official support, isn't it?

That's all I've got for now. I'm sure I'll come up with more wanted Flash features.

7 comments:

Pedram said...

wow, you have a creative mind!
I think "Complete Generics" Idea is very cool.
I like your blog ;)

Moley said...

sounds like you need to start using haxe.

CJ Cat said...

Yeah. I know haXe supports generics, and I would like to learn it if I've got enough time.

There's still one thing I need to make sure about, however. HaXe's support for generics works only with other haXe code, right? There's no such support after compiling my generics classes into SWC files, later used with AS clsses, right?

Joseph Burchett said...

Great list, really agree on the generics and especially the function overloading... I mean seriously, it's like OOP 101. Also just for the heck of it why not throw "operator overloading" in there to ;-)

CJ Cat said...

Right. Operator overloading. That could be pretty useful. Although it does not provide any new functionality, at least it's gonna make your code much more cleaner!

wwwebber said...

completely agree with the entire list. the lack of function overloading is almost unbelievable and constantly drives me crazy

how about 1 more thing for the list--a much faster compiler!

love stardust by the way--am using it for my latest game. thanks for providing such a sweet library.

CJ Cat said...

Awesome. Remember to send me a link when your game is finished!