ECMAScript 4 Milestone 2 Released
Date : 2008 02 26 Category : Tech & DevelopmentECMAScript 4 M2 has been released and Francis Cheng has posted about the new version. M2 fully implements:
classes and interfaces namespaces pragmas let, const, let-const iterators enumerability control type expressions / definitions / annotations runtime type checks (”standard mode”) nullability destructuring assignment slice syntax hashcode catchalls map & vector date & time improvements meta objects static generics string trim typeof globals 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.David Tucker has posted about Colin Moock and his new lecture notes on the language changes that include:
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.