4 ms·
I would argue that Elixir is far closer to being a "JavaScript-like language for concurrent programming" than Go, due to it's dynamic typing and relative freedo
by zensavona 9y ago
I would argue that Elixir is far closer to being a "JavaScript-like language for concurrent programming" than Go, due to it's dynamic typing and relative freedom it affords in comparison to the others you mentioned (except for Clojure, which is actually quite similar in a lot of ways).
Although it is technically a purely functional language, you can almost mutate variables (in reality it is creating a new immutable variable with the same name, which takes precedence)
a = 1
# a == 1
a = 2
# a == 2
Concurrency feels very natural:
# concurrent
numbers = [1,2,3,4,5]
doubles =
|> numbers
|> Enum.map(fn(n) -> Task.async(fn -> n * 2 end) end)
|> Enum.map(&Task.await/1)
# doubles == [2,4,6,8,10]
# consecutive
numbers = [1,2,3,4,5]
doubles = numbers |> Enum.map(fn(n) -> n * 2 end)
# doubles == [2,4,6,8,10]
- runeks 9y ago> Although it is technically a purely functional language [..] This (purity) stirred my interest, but as far as I can see it's incorrect. This[1] Wikipedia page on pure languages does not list Elixir, and the Elixir Wikipedia page itself does not mention purity at all. Can anyone clarify? [1] https://en.wikipedia.org/wiki/List_of_programming_languages_by_type#Pure https://en.wikipedia.org/wiki/List_of_programming_languages_...