CoffeeScript 1.7.0 发布

oschina
 oschina
发布于 2014年01月29日
收藏 3

CoffeeScript 1.7.0 发布,此版本更新内容如下:

  • When requiring CoffeeScript files in Node you must now explicitly register the compiler. This can be done with require 'coffee-script/register' or CoffeeScript.register(). Also for configuration such as Mocha's, use coffee-script/register.

  • Improved error messages, source maps and stack traces. Source maps now use the updated //# syntax.

  • Leading . now closes all open calls, allowing for simpler chaining syntax.

  • Added **, // and %% operators and ... expansion in paramater lists and destructuring expressions.

  • Multiline strings are now joined by a single space and ignore all indentation. A backslash at the end of a line can denote the amount of whitespace between lines, in both strings and heredocs. Backslashes correctly escape whitespace in block regexes.

  • Closing brackets can now be indented and therefore no longer cause unexpected error.

  • Several breaking compilation fixes. Non-callable literals (strings, numbers etc.) don't compile in a call now and multiple postfix conditionals compile properly. Postfix conditionals and loops always bind object literals. Conditional assignment compiles properly in subexpressions. super is disallowed outside of methods and works correctly inside for loops.

  • Formatting of compiled block comments has been improved.

  • No more -p folders on Windows.

  • The options object passed to CoffeeScript is no longer mutated.

CoffeeScript这一门编程语言构建在JavaScript之上,其被编译成高效的JavaScript,这样你就可以在web浏览器上运 行它,或是通过诸如用于服务器端应用的Node.js一类的技术来使用它。编译过程通常都很简单,产生出来的JavaScript与许多的最佳做法都保持 了一致。

先来看下对比代码(左为CoffeeScript):

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处,尊重他人劳动共创开源社区。
转载请注明:文章转载自 OSCHINA 社区 [http://www.oschina.net]
本文标题:CoffeeScript 1.7.0 发布
加载中

最新评论(4

o轻扬o
o轻扬o
热泪盈眶。。。
Jaware
Jaware

引用来自“gakaki”的评论

https://github.com/jashkenas/coffee-script/wiki/List-of-languages-that-compile-to-JS

老实说说从语法上明显要比走静态语言路线的 google dart 和 同样的 typescript 好 可惜知道的人不多 还有个很有名的亲兄弟 livescript

小哥说话要负责任
hantsy
hantsy
要开发方便还不如使用 Java,,,GWT
gakaki
gakaki
https://github.com/jashkenas/coffee-script/wiki/List-of-languages-that-compile-to-JS

老实说说从语法上明显要比走静态语言路线的 google dart 和 同样的 typescript 好 可惜知道的人不多 还有个很有名的亲兄弟 livescript
返回顶部
顶部