Please add support for typed Arrays

Topics: Language Specification
Oct 3, 2012 at 6:15 PM

This would assume support for Generics of type Array (A generic declaration induces a family of declarations, one for each set of actual type parameters provided in the program).

For example a string Array could be declared as:

var arr : Array = new  Array();

// then only elements of type 'string' could be added to 'arr'
arr[0] = "hello";

// using elements other than of type 'string' would trigger compile time errors:
arr[0] = 43;

Thanks!

 

 

Oct 3, 2012 at 6:24 PM
Edited Oct 3, 2012 at 6:24 PM

Typed arrays are already possible with this syntax:

 

var arr : number[] = [];
Oct 3, 2012 at 7:04 PM

Yes, you are right. I overlooked that in the spec.

Please close this thread!

- Bernd