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!
4 kommentarer:
Congrats on the release! This is a neat piece of work.
One correction, ECMAScript 4 and ECMAScript Harmony are not really the same thing. ES4 is more-or-less dead. ES-Harmony is the ES version that will come after 3.1. From everything I've heard (and I know a couple of folks in the working group), Harmony is very scaled back from ES4. The plus side is that Harmony will actually come to exist... it's just unlikely to do as much as what you've done with Mascara.
Hi Dangoor, and thank you!
Harmony is the current code word for the version which will come after 3.1. But I suspect it will still get the official name ECMAScript 4.0 when released, since it will still be a significant upgrade to ECMAScript 3.
However, as you say, it will be scaled back compared to the earlier plans for version 4.0. What was known as ES4 will probably be more like ES5 or ES6.
I think it is a good thing that the working group have decided on a more incremental approach. As you say, it makes it more realistic that it will actually get implemented.
It also means that Mascara is more than one generation ahead of the future ;-)
Congratulations!
@Matthias: Thank you :-)
Send en kommentar