4 ms·
Is Clojure better than Erlang?
by nodivbyzero 10y ago
Is Clojure better than Erlang?
- sgift 10y agoDepends on your definition of better. It runs on the JVM, so you have easy access to the whole ecosystem of libraries. For me, that's always a big plus compared to non-JVM languages, but if you don't use that the case gets less clear.
- mping 10y agoStarted doing some erlang work, I'm very impressed in the overall design of the thing. I'd say erlang is very well suited for heavy,low-latency networking because of the design of the VM and the characteristics of the language, whereas clojure is a bit up the stack. Anyway if you prefere parenthesis you got Lisp flavoured erlang: http://lfe.io http://lfe.io
- pron 10y agoThe problem with Erlang is that it's veeeery slow, so you'll need to write the computation-heavy stuff in C.
- networked 10y agoI am new to Erlang. I assume that you mean writing a linked-in driver or NIFs. Unless you need very low and precisely controlled latency for your computation-heavy code, too, why not write it, e.g., in Python with NumPy and talk to the Python process over a port?
- pron 10y agoYou could. Or you could just run on the JVM. Either way, there are some tradeoffs to make.
- elcritch 10y agoThere's a port of Erlang that runs on the JVM [1]. If you've got a lot of code in Erlang it could be beneficial. The language would the same, and you can choose VMs suited for a specific tasks. Or I'd like trying to use Elixir and Julia, probably over 0MQ or similar. 1: https://github.com/trifork/erjang https://github.com/trifork/erjang
- retrogradeorbit 10y agoI use them both. They are very different beasts. I wouldn't say one is better than the other. They have different trade offs. In Clojure I miss the preemptive VM support for the Erlang "processes", the pattern matching and the elegance of the pid mailboxes. In Erlang I miss the fantastic built in data structures, the platform reach (targeting the browser for example), the syntax (refactoring clojure is a dream), macros, the REPL, the tooling, the time constructs (refs, agents, atoms) and a bunch off more esoteric stuff. (I don't miss core.async cause Erlangs processes are much better). I tend to use Clojure by default and Erlang when the problem particularly suits it.
- joncampbelldev 10y agoAs an aside, you can get pattern matching in clojure as a library[0], though I'm not familiar with erlang so I can't say if clojure's implementation is a complete match in terms of functionality. [0] https://github.com/clojure/core.match https://github.com/clojure/core.match
- elcritch 10y agoElixir has brought some interesting dynamics into the mix. Although the ErlangVM's time handling is a bit rudimentary to me. What are these refs/agents/atoms you mention?