Version 0.3.6 is now released. Numerous improvements:
static initializer blocks and static methods are now supported correctly. They work basically like in Java.
Array type literals are supported. They have an interesting syntax:
var a : [...int] = [1,2,3]; // a variable size array of integers
var b : [int, int, int] = [1,2,3]; //a fixed size array of three integers.
So the three dots mean "any number of". Fixed sized arrays can be heterogenous:
var c : [int, String, boolean] = [7, "hello", false];
And believe it or not, an array can even be a combination of heterogeneous types and variable size:
var d : [boolean, String, ...int] = [true, "hello", 1, 2, 3];
The first two items are boolean and String, end every item after is int.
Destructuring variable definitions is also supported now. This allows you to write:
var [a, b] = [1,2];
This is especially useful when returning arrays from a function, e.g.:
function f() { return [1, 2]; }
var [a,b] = f();
fredag den 18. juli 2008
Abonner på:
Kommentarer til indlægget (Atom)
This blog has moved to http://blog.mascaraengine.com. See you!
This blog is (was) for news, announcements and questions regarding the
Mascara ECMAScript 6 -> JavaScript translator.
This blog is (was) for news, announcements and questions regarding the
Mascara ECMAScript 6 -> JavaScript translator.
Ingen kommentarer:
Send en kommentar