LiveScript 1.3.0 released - Generators and Yield!

LiveScript is a language which compiles to JavaScript. It has a straightforward mapping to JavaScript and allows you to write expressive code devoid of repetitive boilerplate. While LiveScript adds many features to assist in functional style programming, it also has many improvements for object oriented and imperative programming.

For more information, check out the LiveScript site.

1.3.0

LiveScript 1.3.0 fixes many bugs and adds some new features, including generator and yield support!

Generators and Yield

You can now use generators and yield in your LiveScript code! A brief rundown:

function* f yield "foo" g = ->* yield from f! yield "bar" h = g! h.next!.value + h.next!.value #=> "foobar" var g, h; function* f(){ yield "foo"; } g = function*(){ yield* f(); yield "bar"; }; h = g(); h.next().value + h.next().value;

You can create generators by either appending a star * to the function keyword, or appending it to LiveScript's arrow notation. This works with the variety of arrows we have.

yield is simply the same as in JavaScript, and yield from is JavaScript's yield* .

To run code using generators and yield using node 0.11, use the --harmony flag. If running directly with lsc , use lsc file.ls --nodejs --harmony to pass the harmony flag to node.

vim-ls has been updated to highlight yield and also has many other improvements.

require!

require! has been changed around to be more straightforward to use: require! {a: b} has been changed to mean b = require('a') , and you can now destructure, eg:

require! { fs: filesystem 'prelude-ls': {map, id} path: {join, resolve}:p } var filesystem, ref$, map, id, p, join, resolve; filesystem = require('fs'); ref$ = require('prelude-ls'), map = ref$.map, id = ref$.id; p = require('path'), join = p.join, resolve = p.resolve;

Pipe and Assign Precedence

One bug whose fix may break some code is the precedence of the pipe operator and assign. Assign now has a lower precedence than all pipes, so