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

随着 JavaScript 虚拟机变得越来越普及且快速,许多新的语言和运行时开始将其目标定位为 JavaScript。例如 CoffeeScript,它旨在改进 JavaScript 的一些不足,并添加了一些有用的功能。此外,还有 StratifiedJS 通过添加并发相关的关键词来解决异步编程的问题。同时,Emscripten 项目则尝试将 LLVM 编译器支持的语言转化为 JavaScript。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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 released 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. 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.

转载于:https://www.cnblogs.com/mengheyun/archive/2010/12/27/1962983.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值