BT
x Your opinion matters! Please fill in the InfoQ Survey about your reading habits!

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

by Werner Schuster on Dec 25, 2010 |

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.

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2014 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT