You can try it out online here.
Thanks to everyone who supported along the way!
To sum up, Mascara is a tool which extends JavaScript with a number of powerful features like Classes, namespaces, type-verifications and so on, and then translates this advanced code into "object-code" which will run in any browser. This allows forward-thinking developers to take advantage of future improvement to JavaScript, today.
The background is this: JavaScript was initially designed for small scripting tasks, and does not support features like classes, packages and types useful for structuring larger programs. However, today JavaScript is increasingly used for larger and more complex applications, and these shortcomings becomes a problem. Larger JavaScript applications easily becomes slow and error-prone to develop and costly to maintain.
Luckily, the ECMA organization which maintains the JavaScript standard, have developed a number of improvements to JavaScript, to alleviate these problems. This new standards is known as ECMAScript 4 or ECMAScript Harmony. However, due to browser wars and politics, it may take years before it is implemented in all new browsers, and even then we will have to worry about backwards compatibility with legacy browsers.
Mascara solves this problem, and allows us to use ECMAScript 4 today.
Some of the features in Mascara are:
- Classes and inheritance
- Array comprehensions (akin to list comprehensions in e.g. Python and Haskell)
- Destructuring assignments
- A type system with parameterized types, higher-order function types, structural types, union types and nullable and non-nullable types. Type inference eliminates the need for redundant type annotations.
- For-each loops
- Packages and namespaces
- Optional, named and rest-parameters in function signatures.
- Multiline strings and regular expressions.
Mascara can be tried out and explored without installing anything, by using the online tool.
Have fun!