When comparing LiveScript vs Earl Grey, the Slant community recommends LiveScript for most people. In the question“What are the best languages that compile to JavaScript? ” LiveScript is ranked 27th while Earl Grey is ranked 29th. The most important reason people chose LiveScript is:
LiveScript has terse syntax for common functional operations like map, and ships with a library, prelude.ls, with many of the functions most commonly used by functional programmers.
Ranked in these QuestionsQuestion Ranking
Pros
Pro Designed for High-level functional code
LiveScript has terse syntax for common functional operations like map, and ships with a library, prelude.ls, with many of the functions most commonly used by functional programmers.
Pro Good amount of programmer flexibility
There's a huge range of features that can make common tasks faster.
Pro ECMA 6 Features
It is the declared goal of LiveScript’s creators to track ECMAScript 6. Hence, the language gives you ECMAScript 6 plus type annotations (which are optional).
LiveScript's module syntax is currently a bit behind the ECMAScript 6 specification (something that will be fixed eventually). It supports two module standards: CJS (Node.js) and AMD (RequireJS).
Pro Fixes coffeescript scoping issues
=
is used to declare variables in the current scope, in order to redeclare variables of outer scope :=
is used. This way bugs are reduced.
Pro Supported by WebStorm and Visual Studio
Pro Powerful hygienic macros
Earl Grey's macro system allows for creating powerful control structures that look just like builtin ones. EG also supports macro libraries which allows developers to provide their macros/DSLs for others to use.
Pro Pattern matching
Pattern matching is an incredibly powerful tool that, once you've tried, you cannot live without. This is not your average hacked-together pattern matching but a complete and integral feature to the language.
Pro ECMAScript 6 Asynchrony
Earl Grey provides Promises based on ECMAScript version 6 and as many NPM libraries already implement. Earl Grey also provides a promisify
function that converts old-fashioned callback-style asynchrony to promises.
Pro Fully compatible with Node.js ecosystem
Anything available on NPM can be used just as easily with Earl Grey. In fact, everything else can be used too! Earl Grey has interfaces to Browserify, Webpack, and even experimental support for SystemJS. Earl Grey can even be used to generate npm packages that any node-compatible language can use!
Cons
Con Strong functional lean
LiveScript is designed to be a high level functional language. For people who prefer a more imperative approach it can be hard to get used to.
Con Compiles to unreadable javascript
JSON.stringify(
each(upCaseName)(
sortBy(function(it){
return it.id;
})(
(function(){
var i$, ref$, len$, ref1$, j$, len1$, ref2$, results$ = [];
for (i$ = 0, len$ = (ref$ = table1).length; i$ < len$; ++i$) {
ref1$ = ref$[i$], id1 = ref1$.id, name = ref1$.name;
for (j$ = 0, len1$ = (ref1$ = table2).length; j$ < len1$; ++j$) {
ref2$ = ref1$[j$], id2 = ref2$.id, age = ref2$.age;
if (id1 === id2) {
results$.push({
id: id1,
name: name,
age: age
});
}
}
}
return results$;
}()))));
Con Not true static typing
EG gives you the tools to implement your own type-checking inside of argument lists and elsewhere but there's no analysis done at compile-time like other compile-to-js languages.
Con Unfamiliar syntax
While the language shares a lot of DNA with Python, there are still many new (and interesting) features/sugar that may take some time to get used to.