Hi! This blog is for news, announcements and questions regarding the
Mascara JavaScript compiler.

See also:
The online demo
Download latest release

Contact:
olav@olav.dk

Disclaimer:
ECMAScript is a trademark of Ecma International.

Powered by Squarespace
« Version 0.4 released. | Main | Version 0.3 released »
Friday
Jul182008

Version 0.3.6

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();

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>