LiveScript vs Elixir
When comparing LiveScript vs Elixir, the Slant community recommends Elixir for most people. In the question“What are the best (productivity-enhancing, well-designed, and concise, rather than just popular or time-tested) programming languages?” Elixir is ranked 3rd while LiveScript is ranked 67th. The most important reason people chose Elixir is:
Leverages the existing Erlang BEAM VM
Specs
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 Great for concurrency
Leverages the existing Erlang BEAM VM
Pro Great getting started tutorials
The tutorials are very clear and concise (even for a person not used to functional programming). Plus they are also very mobile friendly.
Pro Powerful metaprogramming
Write code that writes code with Elixir macros. Macros make metaprogramming possible and define the language itself.
Pro Full access to Erlang functions
You can call Erlang functions directly without any overhead: https://elixir-lang.org/getting-started/erlang-libraries.html
Pro Scalability
Elixir programming is ideal for applications that have many users or are actively growing their audience. Elixir can easily cope with much traffic without extra costs for additional servers.
More details can be found here.
Pro Great as a first functional programming language!
Pro Great documentation
Elixir's documentation is very good. It covers everything and always helps solving any problem you may have. It's also always available from the terminal.
Pro Syntax is similar to Ruby, making it familiar for people used to OOP
All of the benefits of Erlang; without as steep a learning curve of prolog based syntax. Elixir is heavily inspired by Ruby's syntax which many people love.
Pro Easy to download libraries
Comes with built in build tool called "mix". This will automatically download libraries and put them in the scope of the application when you add them to the "deps" function and run mix deps.get
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 Deployment is still not as easy as it should be
Con Some design choices may seem strange
Some design choices could have been a little more appealing, for example: using "do...end" comes natural in Ruby for blocks but Elixir uses them for everything and it looks pretty weird:
Enum.map [1, 2, 3], fn(x) -> x * 2 end
or
receive do
{:hello, msg} -> msg
{:world, msg} -> "won't match"
end