LiveScript 1.0.0 发布!

2012年7月30日 - George Zahariev

经过6个月的开发,LiveScript 1.0.0 已经发布!

LiveScript 是一种编译成 JavaScript 的语言。它是 Coco 的分支,而 Coco 又源自 CoffeeScript。与这两者一样,它具有相对简单的 JavaScript 映射。LiveScript 是 Coco,但与 CoffeeScript 更加兼容,更具功能性,并且功能更丰富。LiveScript 旨在提高表达力和代码美观度。

在添加功能来辅助函数式编程的同时,LiveScript 也深度支持命令式和面向对象编程,并具有可选的类系统,包括继承、对超类的调用等等。

更多信息,请查看 LiveScript 网站

1.0.0

1.0.0 版本的发布意味着 LiveScript 已准备好投入使用!这意味着稳定性和对任何向后不兼容更改的大量提前通知。

许多人已经在使用 LiveScript!以下是我找到的一些部分列表

  • ethercalc - Node.js 版的多用户 SocialCalc 电子表格
  • jscex-jquery - jQuery 1.5+ 的 Async/Await 支持
  • q-jscex - Q promise 的 Async/Await 语法支持
  • node-cluster-server - Node 0.6+ 的简单多 CPU 集群服务器管理器
  • letris-solver - Letris(和 Draw Something)的简单基于 Web 的求解器
  • prelude.ls - LiveScript 推荐的基础库
  • Gusto - Node.js 的美味 MVC(另请参阅 Gusto-Blank
  • okiba - LiveScript + express 示例
  • moros - 使用多调度程序函数的 DOOM 处理实用程序。也适用于 NodeLists
  • Slake Build Utilities - Slakefiles 的构建实用程序
  • jsk-togglable - Web 页面中可切换元素的基本行为。
  • jsk-tabs - Web 页面中选项卡组件的基本行为。
  • brunch - LiveScript 分支 - 简化 HTML5 应用程序开发。
  • express-livescript-assets - LiveScript、express、connect-assets 示例
  • LiveShell - 用 LiveScript 编写的实验性 shell

是否有用 LiveScript 编写的项目?将其添加到 维基页面

更改

1.0.0 带来了许多更改 - 以下是其中的一些示例,完整列表请查看 更改日志

级联 - 漂亮的链式调用

a = [2 7 1 8]
  ..push 3
  ..shift!
  ..sort!
a #=> [1,3,7,8]

document.querySelector \h1
  ..style
    ..color    = \red
    ..fontSize = \large
  ..innerHTML = 'LIVESCRIPT!'
var x$, a, y$;
x$ = a = [2, 7, 1, 8];
x$.push(3);
x$.shift();
x$.sort();
a;

x$ = document.querySelector('h1');
y$ = x$.style;
y$.color = 'red';
y$.fontSize = 'large';
x$.innerHTML = 'LIVESCRIPT!';

您现在可以为解构参数设置默认值,其功能类似于 Python 的关键字参数。

setCords = ({x = 1, y = 3} = {}) -> "#x,#y"
setCords y: 2, x: 3 #=> '3,2'
setCords x: 2       #=> '2,3'
setCords y: 7       #=> '1,7'
setCords!           #=> '1,3'
var setCords;
setCords = function(arg$){
  var ref$, ref1$, x, y;
  ref$ = arg$ != null
    ? arg$
    : {}, x = (ref1$ = ref$.x) != null ? ref1$ : 1, y = (ref1$ = ref$.y) != null ? ref1$ : 3;
  return x + "," + y;
};
setCords({
  y: 2,
  x: 3
});
setCords({
  x: 2
});
setCords({
  y: 7
});
setCords();

where 类似于 let,但在主体之后定义。它也略有不同,因为它允许嵌套变量声明。

result = x + y
       where x = 4,
             y = x + 1
       #=> 9
var result;
result = (function(x, y){
  x = 4;
  y = x + 1;
  return x + y;
}.call(this, void 8, void 8));

更多信息请参见 更改日志

结论

如果没有你们的许多贡献和支持,LiveScript 将不可能实现。谢谢!

许多人已开始在他们的项目中使用 LiveScript - 您可以查看 用 LiveScript 编写的项目 的部分列表,以及 支持 LiveScript 的项目

有任何想法或建议?您可以在 GitHub 上创建工单 或在 LiveScript Google Group 上提出一般问题。

最后,更多信息,请查看 LiveScript 网站


有关 LiveScript 和 prelude.ls 的更多信息,请

评论由 Disqus 提供支持