BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Languages Come to Javascript VMs: CoffeeScript 1.0, StratifiedJS, C/C++ with Emscripten, Python

Languages Come to Javascript VMs: CoffeeScript 1.0, StratifiedJS, C/C++ with Emscripten, Python

Javascript VMs are now ubiquitous and increasingly fast - two attributes language designers and implementers like. Languages that target the JVM or.NET have seen a lot of interest, but recently a lot of new languages and language runtimes target Javascript.

A pain point of Javascript is the language itself, so developers are creating new languages that compile to Javascript.
CoffeeScript, which has just release version 1.0, is a new language that aims to clean up Javascript and add a few useful features. The CoffeeScript compiler is written in CoffeeScript and compiles to clean and pretty printed Javascript.
Significant whitespace is used instead of braces to delimit blocks - a fact that will keep discussion forums buzzing, although it is in line with other recent languages like CSS3 extension Sass, Haml, etc.

Coffeescript has been around for about a year, and has recently gained exposure through a few public projects that used it. ArsTechnica's iPad application is written using HTML and Coffeescript and runs as native application using PhoneGap. 37Signal has published Chalk, a whiteboard app that runs on the iPad and uses HTML5 features, such as the Cache Manifest, to run offline. It also uses Coffeescript.

StratifiedJS is a superset of Javascript that adds a few concurrency related keywords to adress the verbosity of async programming. For more details see the interview which describes the motivation behind StratifiedJS and the browser implementation Apollo.

The Emscripten project uses a different approach to bringing languages to the Javascript VM. Emscripten tries to bring languages with LLVM compilers to Javascript VMs. LLVM can compile code to bitcode which Emscripten then and translates to Javascript. Manual memory allocation is supported to a degree; Emscripten emulates it with a heap array that's managed by a custom version of malloc.

C and C++ code can be translated using Emscripten and the project's site has a few demos of translated C and C++ libraries. However, it also has demos of translated versions of Python and Lua runtimes.

Next to these new languages and translated runtimes, existing languages also get ported to Javascript, such as Haskell, Steve Dekorte's Io language as well as Python again with the Skulpt project.

It remains to be seen which of these approaches will prove successful and useful. One thing is certain, though: Javascript VM, JIT and GC developers had better keep the performance improvements coming if approaches like Emscripten become popular.

Rate this Article

Adoption
Style

BT