So apparently flex compiler supports what they call "Vectors", which are arrays whose elements are all of a declared type. They are said to compile to more efficient code.
They describe the syntax below http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7ee1.html Creating a Vector instance You create a Vector instance by calling the Vector.<T>() constructor. You can also create a Vector by calling the Vector.<T>() global function. That function converts a specified object to a Vector instance. ActionScript has no Vector equivalent to Array literal syntax. Any time you declare a Vector variable (or similarly, a Vector method parameter or method return type) you specify the base type of the Vector variable. You also specify the base type when you create a Vector instance by calling the Vector.<T>() constructor. Put another way, any time you use the term Vector in ActionScript, it is accompanied by a base type. You specify the Vector’s base type using type parameter syntax. The type parameter immediately follows the word Vector in the code. It consists of a dot ( . ), then the base class name surrounded by angle brackets ( <> ), as shown in this example: var v:Vector.<String>; v = new Vector.<String>(); In the first line of the example, the variable v is declared as a Vector.<String> instance. In other words, it represents an indexed array that can only hold String instances. The second line calls the Vector() constructor to create an instance of the same Vector type (that is, a Vector whose elements are all String objects). It assigns that object to v . That looks like the new Java 'generics' syntax, right? In the new flash text layout package, some of the API's text engine classes require Vector arguments. Our compiler doesn't understand this syntax, I assume. I think I can deal with this in the kernel using #passthrough blocks where I need to construct or access Vectors. Is this likely to become standard javascript? Should we be supporting the syntax in our script compiler? Seems a little bit of a stretch... -- Henry Minsky Software Architect [email protected]
