Tuesday, February 26th, 2008p>ECMAScript 4 M2 has been released and Francis Cheng has posted about the new version. M2 fully implements:
- classes and interfaces
- let, const, let-const
- enumerability control
- type expressions / definitions / annotations
- runtime type checks (“standard mode”)
- destructuring assignment
- slice syntax
- map & vector
- date & time improvements
- meta objects
- static generics
- string trim
- expression closures
- name objects
- type operators (is / to / cast / wrap)
Francis also posted about Vectors:
A new built-in class named Vector is proposed for ECMAScript edition 4. This class is similar to the Array class, but is designed for better performance, efficiency and error checking. Some interesting aspects of the Vector class:
- vectors are dense;
- vectors do bounds checking;
- vectors can be fixed length;
- vectors have type parameters;
- vectors have the same methods as arrays.
- Generic Functions: This functionality will add Java-style method overloading to ActionScript. A function must be defined with the keyword
generic, but then mutliple methods (with different method signatures) can be used.
- Iterators and Generators: Increased support for iterating over a series of values using a class defined iterator. Both of these items are very Python-like.
- Proper Tail Calls: A function can properly call another function as its last operation – this adds increased support for recursion patterns.
- New Number Types: byte, double, decimal (and the current generic â€˜Numberâ€™ type would be removed)
- Numeric Suffixes: As in Java, numeric literals will have suffixes to denote their specific numeric type.
- Vector Type: As in Java, there will be a mono-typed array called Vector. Length can optionally be pre-defined at creation.
- Record Type: Describes the details of an object – easier to create than a class. I believe it is dynamic – in that it has required values, but additional properties can be defined per instance.
- Array Type: A type that describes what will be contained within an array. For example – you could say that you will have a 7-element array made up of Strings.
- Union Types: A property (or argument) could be one of a list of types (as opposed to now where a property has to be of one type – or no type). This would give you the ability to have an argument that could be a String or XML – but nothing else.
ES4 keeps on chugging.
Posted by Dion Almaer at 8:12 am