202 points · by gordonguthrie · 12y ago · 237 comments
The Erlang community is the last place with insight into why Erlang is not popular.
So lets ask people NOT in the community. Here is a list of hypotheses.
Erlang is not more successful because:
* OTP means Open Telephony Platform
* Erlang/OTP is run by Ericsson
* the syntax is prolog-y & not c-y or ruby-y or python-y, its just too damn erlang-y
* no package manager
* no list of open source packages
* no community site
* the mailing list is the community
* everyone knows each other from Stockholm
* it is too hard to get a first working app
* lists for strings, aargh!
* no for loops, eek!
* variables don't vary, whimper!
* people don't learn OTP first but start with Erlang
* people don't learn Erlang first but start with OTP
* no docs
* too many docs but it is the wrong sort
* not enough teaching materials
* doesn't run on the JVM
* we used to think that it was because there were no books...
* Erlang Solutions isn't a proper internet company
* the language develops too slowly
* emacs is the IDE
Some things people are pinning their hats on:
* more books, yay!
* WhatsApp!
* Elixir is irresistable to Rubyists
* LuvvieScript will prove irresistable to the JSers (disclaimer, I'm lying)
* FP is trés, trés à la mode
* LFE & Joxa will be the little lisps that can...
* something will turn up
* something better turn up
* oh God, get me another drink, even at Stockholm prices, I'll be here when something turns up, but by God, a feed of strong drink is the only way to endure the wait
It would be helpful if you would say if you have:
* never used Erlang nor considered it
* tried it & stopped
* use it regularly
So fire away. Do your worst. Hold nothing back.
The syntax is just weird, not only in a paradigm-way (pattern matching is not huge in most languages, but, hey, that's the way of doing stuff in functional programming), but on strange places ("read" lines ending on dot, semicolon takes time, it does not share any common syntax definitions with the languages used by 99% of the programmers). That sets a high bar in approaching the language, so it's difficult to "play around" with it (at least compared with other languages)
While I like some of the advantages of Erlang, the lack of general support for a lot of common operations (and yes, string manipulation is a huge deal) and the fact that it is designed with a very very particular problem in mind makes it "a silver bullet". Not in the usual meaning, but in the way that's only useful for killing a werewolf. For every other task is too expensive and just not the proper tool. I was involved in a project that used Erlang for something not well suited for it, and it was absolutely awful, you have to wrestle with it to perform common stuff that in other languages is done by the standard library. Again, you win something, but only in a very very VERY specific problem.
(I've used it in another project when it was the proper tool, and, in that case, it's still not the most pleasant experience, but you're getting a clear win)
If you have fewer than a million people using your application at a time, you're probably better off writing it in a more normal language.
It's pretty dang easy to do that today with LuaJIT/C, and you don't get any of the other baggage (weird syntax, sub-standard string handling, lack of libs, etc.).
I'm literally building something that is right in Erlang's wheelhouse—exactly what is is designed for, and I'm not using it, despite knowing that, because it's easier for me to get exactly what I want in LuaJIT/C today.
I get garbage collection when I want it. I get arena allocation when I want it, too.
I get custom JIT-compiled functions when I want them (DynASM), but I also get JIT-compiled methods in Lua when performance matters less.
I can talk directly to my network hardware with a driver written in Lua. That's likely possible in Erlang, but I have no idea how and no time to learn, either.
I also know how to solve anything I'm likely to encounter in C. With Erlang, I'd have to learn a new way to solve it. Who knows how long that would take to do well?
I really do like Erlang at the conceptual level, but not enough to endure all of the other things I don't like about it. I'm also far less concerned about C than I was 10 years ago. The tooling around C these days is really quite incredible for people who want to do safety-critical systems, or high-availability systems, or whatever. You can get as much assurance about your code as you want with a reasonable amount of effort.
Following the Erlang Quickstart [2] link, I get a page that doesn't really tell me anything about the language. It demonstrates a program that implements a factorial function, then tells me to go write games. Other than "Burn the CPU", I'm not sure what kind of games I can write with what I learned here.
The first link to more documentation at the bottom of the page goes to a book's website, so that's a dead end. The second link goes to an online reference guide [3] which seems more promising, until I read the introduction [4]. Under "Things Left Out" is "How to communicate with the outside world". Hrm...
So, what I have so far is that Erlang is a functional language, and that the online reference doesn't cover interaction with anything outside of your program. Based on this I'm guessing that Erlang is one of those functional languages that are great for mathematical proof-like software development but not practical for solving actual problems because the world is mutable and the language constructs are not. Yes, I'm making a big inference here, but that definitely seems like where I'm heading.
So I'm going to stop here, and do some real work in a pragmatic language.
[2] http://www.erlang.org/static/getting_started_quickly.html
[3] http://www.erlang.org/doc/getting_started/users_guide.html
[4] http://www.erlang.org/doc/getting_started/intro.html#id62800
It was actually designed to solve actual problems. Specifically, extremely high reliability in some of Ericsson's core networking gear.
I'd recommend Learn You Some Erlang[0] if you intend to look at it again. It explains the language, then OTP (the Open Telephony Platform - a framework for defining Erlang process trees and failure modes), then basic outside communication and disk storage.
i.e. showing him how his thought was wrong doesn't change the fact that many other people will probably make a similar thoughts.
> "that the online reference doesn't cover interaction with anything outside of your program" This does NOT mean it does not teach you IO. The full bullet point is
> "How to communicate with the outside world and/or software written in other languages (ports). There is however a separate tutorial for this, Interoperability Tutorial"
It means it won't teach you FFI in a tutorial.
> "guessing that Erlang is one of those functional languages that are great for mathematical proof-like software development but not practical for solving actual problems because the world is mutable and the language constructs are not."
I don't know how you got to this dumb conclusion when "What is Erlang?" on the main page clearly states:
> Erlang is a programming language used to build massively scalable soft real-time systems with requirements on high availability. Some of its uses are in telecoms, banking, e-commerce, computer telephony and instant messaging. Erlang's runtime system has built-in support for concurrency, distribution and fault tolerance.
The Google comparison is comical. You are wildly over-estimating how well known Erlang is, even in the dev community.
> Do you really decide whether you'd learn a language by looking at its website?
Most devs learn a new language when it helps them solve a problem. Anyone who needs to solve the problems that Erlang addresses has already at least looked at Erlang.
This thread was also directed at those who have never used Erlang. Starting with the Erlang website makes eminent sense.
Specific example :
Compare the Erland and Rust websites. I've never used Rust or Erlang. I can confidently say that the Rust website does a better job of familiarizing a new user with the language. It's not just a matter of the Rust syntax being C-derived, either. It's simply harder to find any useful information on the Erlang website.
Rust :
* code sample on landing page
* comprehensive tutorial linked directly from landing page
Erlang : * no code on landing page
* "quick start guide" which is basically a link to a non-free book
* Getting to actual code requires 3-4 clicks from the landing page
* e.g. Documentation -> Course -> Sequential Programming
Conclusion : The Erlang website isn't as useful as that of at least 1 other non-mainstream language.Of course it does. But stopping at the Erlang website because of the website makes much less sense. Find some other way to know more about the language and then decide whether you'll use it or not.
Well, it's pretty well known in the competent dev community. Some guy doing CRUD apps for some enterprise might not know it, true.
Kind of! Irrespective of Erlang's site, a well-maintained, informative, and newbie friendly website is often a signal. Maybe it's not a very accurate signal. But it's a signal which suggests that, for lack of a better term, the community exists and has its act together.
There are enough other things to occupy programmers' time. People adopt heuristics like these — "how professional/modern does the website look?" — as a way to save time.
I certainly could see myself doing that. It's usually indicative of the leadership and community that's associated with the language. In Erlang's case I understand that it's pretty niche in the big scheme of things, and that might be the reason. In terms of languages if the information presented isn't on the level of Java, PHP, Ruby, Python and others it comes off as sub-par. That may not be the reality but it's the perception IMO.
You seem to be looking into this from the perspective that everyone must already know what Erlang is all about, so there doesn't need to be an effort to reach out to new users - which would contradict the questions the OP is asking.
It obviously stands for Outlaw Techno Psychobitch ;).
http://www.youtube.com/watch?feature=player_detailpage&v=rRb... (Erlang The Movie II)
Why are you saying a link to Learn You Some Erlang for Great Good [1] is a dead end? Have you missed the "Read it online" button?
Well, you can read the book online, so how's that a dead end?
>So I'm going to stop here, and do some real work in a pragmatic language.
Well, $16B for WhatsApp, for a company with like 40 engineers, proves that Erlang can be quite pragmatic itself.
I was so impressed with Erlang that i'm still banging my head on it nearly 10 (half-hearted) years later.
One of the hardest parts about learning a new language is coming up with a learning project that showcases the unique strengths of the language without being intimidating to a newcomer or too contrived to actually be useful. This is difficult in any language, but it's especially so in Erlang.
Obviously "it's different; people don't like things that are different" has a lot to do with it, but we've seen other FP languages experiencing faster growth recently, so I don't think that can be the only cause.
I've been using it for a few months, for what it's worth.
Edit: obviously there are lots of people who need to write concurrent network server clusters, but I'd argue that the benefits of the Erlang approach are difficult to grasp before you've actually deployed something written in Erlang; simple toy projects (which are a prerequisite to learning a language) don't usually play to its strengths. A language that's really good at web apps is going to grow more quickly simply because its advantages are easier to appreciate from the start.
I didn't find any good tools.
The error messages were obtuse.
I didn't understand how simple shit like configuration files worked. I couldn't find any place where the file was 'opened' from code. I chalked it up to the magic of the underlying framework or whatever.
* Compiler for a scheme-like language in Haskell
* simple webapp in Haskell using Yesod
* small 2d game in Clojure
* racket-based little language that compiles to openscad
* lots of academic programming-languages projects in Racket
(garbage collector, type checker, prolog, etc)My hangups:
- lack of easy-to-use string libraries. far and away the biggest pain point. working in bioinformatics, I deal with a lot of poorly-formatted text.
- installing erlang itself was fine, but installing (and finding) any other packages was a PITA.
- documentation could have been better. I can't remember what specifically I disliked but remember being frustrated trying to find info about builtin nuances.
- syntax. this one seems silly from the outside, but the whole commas-here-but-definitely-not-there and other idiosyncracies really made tweaking code and debugging a pain. Go has similar pains around the "unused variable" errors so I know this type of thing isn't particular to erlang.
Now the answers are a bit more useful, a bit more constructive:
* write more, better docs (Erlang for Java programmers, .. for JS devs, .. Ruby, etc)
* polish the websites, improve search rankings for helpful links (the standard library, etc)
* write at least one good O'Reilly book
* write lots of libraries, especially web frameworks
* integrate seamlessly with other platforms (possible with Clojure, maybe not Erlang)
* upload screencasts "15 Minutes in Erlang", etc
* ...use your imagination
Lisp is another prototypical "our language is awesome, why is it dying?". FreeBSD used to get joked on, too. Well la-dee-da, Erlang on FreeBSD can be a winning combination! These technologies will remain good, but they won't magically make themselves popular. It's not if-you-build-it-they-will-come anymore. There are too many programming languages to get acquainted with even 20% of them. Languages need to be more competitive to be more popular.
Ian Faith: Oh, no, no, no, no, no, not at all. I just think that their appeal is becoming more selective.
It's the quality of the language that counts, but it's the popularity that matters.
I know it gets some use within Ericsson for running quickcheck tests against C-code.
In other words, it was stillborn.
A minority are more fashion-driven - if something seems like the hot new trend they'll jump on it, scoffing at the old-fashioned crap their coworkers are using. Erlang unfortunately is not fashionable, and it's hard to predict or control fashion.
A smaller minority are driven by some concept of technical merit. However, once you've strayed from the safety of Java/C#/etc., it seems like you might as well go all the way and get into Haskell, which is pretty widely seen as the most advanced, mind-expanding, powerful, futuristic programming language right now, and for good reason.
This is exactly what has led me to Haskell. I was doing Python but got interested in Go for Channels and Static Typing. It turned out Go's static typing was a little to weak for me, so it's unsurprising that I came across Haskell shortly thereafter.
The string part specially... will have to check out his binary string code.
* no package manager
This is _huge_. For example: I currently work very heavily with node.js. I understand all of the many, many problems with javascript. NPM single-handedly makes up for all of them put together, in my eyes.
Which is to say - an amazing package manager can make a poor language. A decent package manager (pip, for example) allows a nice language to shine, but won't make or break it. Lack of a package manager could probably kill just about any new languages these days (and Erlang - correct me if I'm wrong - appears to have the popularity of a pretty early-stage language right now).
Second, but more important, my colleagues know C++ (good enough at least). If I started to use something else, we couldn't collaborate. We're physicists, not computer scientists or professional programmers.
Then, I often find myself writing GUI code. I wouldn't know how to start writing a GUI in Erlang, but it's trivial in Python or C++.
If anything, I would need a language centered around mutability, so almost the opposite of erlang. A language where everything is mutable, where you can databind to any object. Where you can just make an array of objects and bind it to a graphical widget, and get create, edit, update, delete operations for free. You never have to write `listview.insert(...)`. Maybe the command pattern is part of the language and it is trivial to write an undo function. And finally, it would include multithreading, with only a simple syncronization primitive, the transaction. The goal of concurrency here would not be speed, but GUI responsiveness.
So, I have two very different use cases, for one I can use C++, for the other the ideal language has not been invented (but C# and Python are both not bad). I just don't know what to do with Erlang (and Haskell, Clojure, and all the other hip languages).
(It's not "C++ fast", of course.)
* No public bug tracker
* epmd's security (or lack thereof)
* Can't insist that epmd be started separately (`erl -no_epmd` won't start epmd but it also won't start epmd's gen_server)
* Can't swap out epmd because while `erl -epmd_module foo` is there, `net_kernel:epmd_module()` is barely used. (Although I don't think its interface is documented anyway)
* No built-in way to hook UNIX signals
* While the documentation itself is pretty good, it's presentation is lacking and it's difficult to quickly correct mistakes as you run into them
* It can be difficult to reason about when a shared binary will be garbage collected
* OS packaging (I'm thinking of Debian/Ubuntu) of Erlang and Erlang apps tends to be more harmful than helpful (old packages, namespace conflicts, etc)
To them I'd add:
* No agreed upon build tool (rebar while prevalent isn't universally accepted)
* Community libraries often have no support for upgrades or aren't packaged properly for releases
* Can't upgrade SSL if you're using it as a carrier
* No standard code format tool like gofmt (yes I know about erl_tidy, no it doesn't provide the same functionality as gofmt or it'd see similar use)
* Not enough infrastructure around built around edoc; where's the godoc or godoc.org work-a-likes? (yes I know about erldocs.com, it's no godoc.org)
If it had an Algol syntax, and performed the SSA transform behind the scene, it would probably be very, very big now.
Bear in mind as I say this that I'm not necessarily advocating for those changes. For instance, this would require some tweaks to the semantics of pattern matching, too, which aren't necessarily for the better... in the abstract. However, they probably would be for the better in terms of usage.
I'm pretty sure Go is going to eat Erlang. Erlang programmers will 100% absolutely correctly complain that OTP can't be translated without loss into Go, and almost nobody will care. Again, I'm not necessarily advocating for this, because the Erlang advocates will be right, you just can't quite get it fully expressed in Go and that saddens me, it's just what's going to happen, I think.
In fact I'm doing it myself; the Erlang core of my system is getting pulled out and replaced by Go for a variety of reasons, and one is despite the fact my team is fairly adventurous over all, we're still better off finding people to work on Go than Erlang. (In the next couple of months I hope to release my first release of "reign", "Rewrite Erlang In Go Nicely", which brings some of the Erlang stuff into Go for the purpose of porting existing programs. I've been pulled into other fire fighting so I'm not on it this second, but I'll be getting back to it soon. That implements Erlang-like mailboxes and network clustering, and I've got a supervisor tree implementation on deck for Github too. Subscribe to https://github.com/thejerf to see when those come out in the next couple of months.)
By the way, Erlang advocates, bear in mind that trying to argue me out of this position is a waste of time. I've been programming in Erlang for 7 years now. I get the syntax just fine, even if I still don't like it. The problem is that you have to argue the greater programming community out of this position, and I don't think you have, and I really doubt you can. For better or worse, being non-Algol seems to put a hard limit on your general-purpose programming acceptance. (In my opinion, that is for the worse, but here we are. Again, please don't mistake this opinion as celebration of any of these facts. My opinion is that Erlang deserves better. My belief is that it won't get it.)
[1]: That's pretty much every modern mainstream language today: C(/++/#), Java, Python, Javascript, etc. Not all those languages come from the same semantic heritage (scripting vs. conventional OO manifest types being one big example), but they come from the same syntactic heritage. Contrast with the ML family, the Lisp family, the Prolog family (which is pretty much just Erlang now), and the Forth family for different syntactic heritages.
[2]: http://evincarofautumn.blogspot.com.es/2012/02/why-concatena...
It is also worth a note that Elixir adds language features, such as default UTF8 binary strings, real macros, Clojure-style protocols, tooling, etc, on top of the Ruby-style syntax.
I wrote about Erlang 7 years ago, and a lot of that still holds true, IMO:
http://journal.dedasys.com/2007/09/22/erlang/
That said, I lately helped start a pretty big project in Erlang and have been using it a lot lately. It has improved, and it's a fun language to use in a lot of ways.
He divided by Algol-like syntax and heritage, not by mere popularity.
I wouldn't be surprised by this. Go's concurrency pattern is fantastic, but to match what Erlang does it needs to be easily extended beyond the running process. Can channels connect multiple "nodes" yet? That is, two running go programs, can they communicate via channels or do they have to use some other IPC mechanism? Across a network? That universal communication structure is (IMO) erlang's killer feature.
My reign library basically just ports over the Erlang idea; asynch messages, PID-like things that can be transmitted across the network and identify the same mailboxes within a cluster. It's meant to be a porting aid, not a solution you'd reach for in Go to create a brand new program. (If you do that, it's on you.) Clustering like this is nontrivial and the big reason I'm sitting on the code locally until clustering is at least working under some circumstances; without clustering support, the mailboxes are just an invitation to write nonidiomatic code for no gain.
Preemptive scheduler, I doubt Go have this, then again Go doesn't have a VM/OS system.
Only for those not versed in java.util.concurrent, TPL, PPL, TBB, Cilk Plus.
(I fiddled with having the user specify a closure that is supposed to "create" a new object for the restart, but then simplified that away when I realized that the closure itself could well have mutable state too. Better just to stick with the simpler interface and document the consequences of failing to clean out state at the beginning of your monitored code. On the plus side, so far the interface for the supervised-things is "Serve()" and "Stop()", and nothing else; hard to argue with that level of simplicity!)
You also won't ever be able to recover live code restarts; you can try to transfer all state to a new process, including file handles, but that's a lot of implementation work. (I'm stuck right now on the fact that my connections are encrypted, and the encryption code won't let me even get to the state, let alone transfer and reconstitute it somewhere else. Someone's got some code for moving file handles around on GitHub but I can't seem to Google it up.) Most people already live in a world where live restarts are difficult or impossible, though, so they won't miss that. Getting a REPL into a live Go server is impossible, at least with Go itself, and will also probably never be as clean as Erlang. (Go "2.0" could fix that with an official Go interpreter, which is the missing bit. I can handle the sockets, I can bind readline and give you a nicer REPL, but interpreting Go is a challenge. Progress is being made, I believe as part of the new compiler implementation, but I'm not sure anyone has this as an explicit goal.) Again, most people live in a world where they already don't have a REPL into their running code, and therefore won't miss this.
There's also some more subtle semantic differences, but I'm saving that for a blog post. (It gets long, especially if I first have to explain Erlang, which is what the blog post does.)
Supervised processes provide guarantees in their initialization phase, not a best effort. This means that they are always restarted to a known stable state. It's not just a question of retrying, it's a question of returning to a piece of data and environment that is reliable. I wrote on this more in details at http://ferd.ca/it-s-about-the-guarantees.html
If you reuse the same exact object again that can be modified, you lose these guarantees entirely, and it becomes a question of convention and attention to detail rather than something provided for you.
The REPL is a vital part of my every day Erlang experience. I can't imagine living without one when things get tricky in production and that pre-built tools aren't enough. Being able to poke around and inspect everything while it runs is great.
runtime: concurrent GC sweep Moves sweep phase out of stoptheworld by adding background sweeper goroutine and lazy on-demand sweeping.
However, too many examples show trivial things like mapping over a list or calculating something recursively. As a professional programmer, I get how those things wrok. What sets these languages apart from Javas of the world is how state is handled. It isn't easy to dig through tutorials and docs to find the best way of keeping state, updating it, referencing it, etc.
I once attempted to implement a small order matcher (from the stock trading world) in Erlang. I know how to do it in imperative languages, but it was pretty painful to do so in Erlang. It was getting very verbose, I wasn't sure how to create a priority queue, how to modify elements in a data structure, etc. Since this wasn't a simple transformation of data, I had a hard time finding references in documentation spread across the web.
I realize that if I was committed to learning Erlang, I would work through a book or two. Perhaps find a small open source project and work through the implementation. However, I, like so many others, wasn't committed. I was merely trying it out and when I couldn't make progress, I decided to use my precious free time on something else.
I sat down one week and prototyped a rewrite of the core exchange in clojure. 40x better throughput and 10x better latency despite using only two threads, naive `pr-str` serialisation and storing all the exchange state in one huge immutable data structure (for easy rollback on errors). Much easier to debug and to wire up different setups without modifying code (eg swapping out the network layer without touching the io and batching code).
There are some interesting ideas in erlang but they are hidden behind an inexpressive language and poor libraries. I would think more than twice before taking on another large erlang project.
Every project I have ever worked on that struggled or failed did so because the complexity outgrew the developers ability to manage it. It kind of scares me that scala is growing so quickly - from my experience working on a large scala project it seems to breed complexity like nothing else I've ever worked with (haskell, python, ocaml, erlang, clojure).
The ability to solve a problem in a particular programming language is often dependent on the ability to express the problem in the constructs provided by the language. A very good example is the problem of concurrency. Doing something concurrently in a primarily procedural/OOP language often seems hacky and it is something that does not feel natural. The actor model that erlang implements is a very powerful model for certain class of problems and concurrency is one of them. Erlang the language, minus the OTP, is extremely small and once you get over the culture shock experienced when it comes to syntax, things will seem pretty easy. OTP isn't magic. Its years and years of erlang experience packaged into one neat library, solving commons problems, so that you can concentrate on your work instead of reinventing the wheel.
Reading Joe Armstrong thesis 'Making reliable distributed systems in the presence of software errors'[1] is highly recommended if you want to understand why things are the way they are.
[1] : http://www.erlang.org/download/armstrong_thesis_2003.pdf
1) The Language actually is not general purposes. Or at least it is not promoted this way. If you really need Actor based model and lightweight threads, you can choose Scala/Akka, that is also well suitable for a wide range of different objectives.
2) Standard library(I mean OTP) is simply ugly.
3) Language's syntax is ugly too. Pascal again? No, thanks. :) I know there is Elixir that fixes most of the issues, but too few people know about it outside of the Erlang community. When someone mention Erlang he/she probably thinks about "vanilla" Erlang, which is ugly again.
P.S. I had been using Erlang for a while and then stopped.
Erlang belongs in this category of languages that have really cool features but which almost nobody has to learn to do a certain job. Nearly everything you can do with Erlang you can do with something else and there are a lot of languages that are necessary for one purpose or another and can't be replaced with Erlang. This is usually because said language is so entrenched in a space that it doesn't make sense to use anything else.
The end result is that programmers only have so much time and only so many projects that they can reasonably devote to their 'fun' language and there are a lot of those from which to choose. Erlang isn't competing with Java, it's competing with Lisp, Smalltalk, Factor, Haskell, OCaml, etc. That's a long list of competition.
Oh yeah, and Clojure beats the pants off Erlang when it comes to performance. Even Erjang is faster than stock Erlang.
Source?
But I actually meant in general. Having real strings and good floating point support helps performance quite a bit.
And one reason it works is because it has built-in those features for building fault-tolerant systems which, for example, Go lacks. Borrowing from NASA "Failure is not an option".
Very few people really need that though, so from a marketing point of view, to sell that as the primary feature is to consign Erlang to a fairly small niche.
I think that in an area like telecoms, it's of course more likely that people care about that a lot more.
It's Erlang's answer to the question "What if there is a bug in the system?" Most languages doesn't answer it ("just dont write buggy code!") but Erlang does and tries to come up with a reasonable solution.
A search example. You have several search algorithms given your input. Run all in parallel, if they crash it's fine. If all crash then the search was a bust, but if one succeeds you terminate the remainder and have your answer.
I stumbled upon Erlang in 2011, and did the full "Learn You Some Erlang for Great Good!" tutorial and about 1/2 of the Erlang Programming book (and exercises). Where I ended up is that I had no real-world use cases that would benefit from Erlang, so I just kind of atrophied with it. It seems to me like Erlang is really really good at building programs that can be modeled with message passing (like chat), but a lot of problems are difficult to map to that paradigm (or perhaps my mind just has trouble envisioning how to do it yet). The closest I got was starting to use it to write a distributed Web crawler, but I ended up using scrapy (a Python framework) because the string manipulation was annoying with Erlang, and scrapy already had a lot of features that I would have had to re-implement on my own. But as I'm starting to try and manage crawler distribution with Celery and RabbitMQ, I find myself starting to think more and more about how Erlang would probably do this bit in particular better, so I might return to it.
The language that I've since discovered I really want for most tasks is Haskell. I've been programming Ruby full-time for the last few years, and I've grown really jaded with it. I get sick of having to write so many unit tests around everything in what I see as a poor fix for its loosy-goosyness. I'm still pretty early on in learning Haskell, but I find the approach towards correctness first to be exactly what I want, and while so far some of the material is pretty challenging I can see it will be very rewarding as well.
There is no good reason that I have encountered yet where I need to use it. Generally I think people try to use the tools they have at their disposal to solve a problem. I have python, and I can do most things in python. It's not always efficient, and as an example, when I first started using python, I blindly used urllib without thinking about it. The requests library has been getting momentum recently, and I found that I prefer it and that it simplifies some of what I do, but at the end of the day why would I have searched for an alternative if what I had was working?
As developers we have to value our time. In an ideal world we would learn everything there was to know about every programming language, and pick the appropriate language for each project. In reality we stop to think that a language is capable of achieving a task, and if it is, we don't look any further.
Ironically, the reason so many people use c/java/python/ruby is because so many people use c/java/python/ruby.
But
1) I don't currently do much that requires any of that.
2) I don't want to learn a completely different 'kind' of language just to hit one pain point.
3) Resources are quite limited (re the website, training, books)
4) and this is the biggee: I just don't want to do functional programming. Our Erlang booster? Want to know how much time he sometimes spent on mailing lists and such asking "how do you do X"? I mean for pretty basic stuff. I get the value of functional programming and immutability ("oh no you don't" you'll respond, but bear with me), but in the end it is too high a price to pay FOR ME. I work in imperative languages, I am comfortable in them, I can't get away from them (I need C++ for speed, for example), I'm just not going to take on a language that kicks my legs out from under me like that. Y'all can argue about the finer points of functional vs whatever, but I'll abstain. I'm interested in solving my problems, and the imperative model works very well for my brain and needs.
So, for me, an interesting toy. I'm 47 and don't have time to chase 'yet another language' which is all this is for me.
Now, if I was trying to solve issues like the ones that got Armstrong to write Erlang in the first place, perhaps I'd revisit it. But as it is? No. No time. Not enough return on the investment.
I think it's similar to the reason why DSP's aren't very popular compared to general-purpose CPUs for most tasks. It's a very specialized tool, designed to solve a very specialized problem. If you don't have that problem, it's not a practical choice because it's more difficult to use and often ill-suited to more common problems. I'm sure plenty of others have mentioned strings already.
Even if you do have that problem, but only a little bit, it might not be a practical choice. There are a lot of tasks where a DSP might perform better but a general-purpose CPU's still preferable because it's good enough, and the skills necessary to work with one are more common. The story's similar for choice of programming language in many applications that require concurrency and fault tolerance, but not to any particularly great extent.
It lacks a good way to do abstract data types (records don't count).
The compiler's ability to optimize is limited by the lack of purely functional guarantees and the metaprogramming facilities (parse transforms) aren't easy to use to work around that.
There's no facility like Haskell's ST or clojure transients to encapsulate mutable stuff, just a hole to write code in C and who really wants to do that? Yes, I know about the process dictionary and ets but those aren't appropriate for most algorithms I've wanted mutability for.
That said, I still use Erlang, but only in the domains where it really shines.
And if you are not using distributed actors, then why bother with Erlang at all?! (It's a nice language to be sure, but there are lots of nice functional languages available so the competition is pretty fierce).
I feel the algol-ization of (functional, prototypical)javascript is a confusing mess and a weakness that makes js harder to use. Making Erlang look object-oriented just seems awkward.
Syntax: comma means AND, semicolon means OR, period means "done." Is that so crazy? There's no comparison to how badly Perl does my head in.
It's a new language, and it won't be 1.0 until later this year, but if you're willing to live on the edge a bit, I think the rewards are well worth it.
That said I just can't get over how bizarre and jarring the syntax is, this paired with the configuration structure and error messages really make it hard to get into to.
Having seen a few talks on the subject I tend to agree, more recently I am using golang for most of the things I intended to do in Erlang.
The reason I chose this route is to stick with a syntax which is common to all the languages i use day to day, while exploring a new, but much smaller toolset for building concurrent applications.
It seemed to me a much wiser route in the long run.
That said I still like the Erlang runtime and the modules it provides, if only the authors of the language could chart a course out of this unusual and sometimes frustrating syntax.
On elixir, I really hope this catches on but unfortunately like coffee script you will still need to get your hands dirty in Erlang if you want to wrap any existing libs or modules available in the runtime, or debug the crazy error messages it produces from time to time.
Also, the "processes only" model is pretty off-putting compared to Scala IMO where you're able to choose between threads and processes. You lose _some_ benefit in reliability (I assume, since it's said so often), but I've never seen that actually play out in the real world. What I have seen is comparably slow IPC exactly a real world development cost. So I'm personally more of a "in-process first" kinda guy.
I may be completely wrong on that one BTW. It's just what I recall from reading half of some Erlang book and studying online material trying to pick up the language.
It wasn't until Scala and Akka that the benefits of both pattern-matching and actors really clicked with me. Though I still prefer Scala's versions on both counts so I don't feel a great need to revisit Erlang at this point since I'm not working with Telco equipment. ;-)
Databases are a giant blob of shared state, albeit a carefully-managed one. People complain about them all the time, but databases completely take over in huge areas of the application development landscape. There's a reason for that -- consistency is a very powerful simplifying assumption (giant understatement). Getting consistency in erlang may be possible, and of course you can still use a database from erlang, but the philosophy doesn't quite line up.
Databases already offer isolation between transactions. And they naturally work with immutable structures similar to functional programming.
For most applications out there, HA means replicating a database, and when it goes down (which is actually quite rare), you lose a little time doing a failover.
Hot code loading means uploading a PHP file with a new extension and "mv"ing it over the old one. Need schema changes? PostgreSQL offers transactional DDL (e.g. ALTER TABLE).
Any error in the database usually just causes that one transaction for that one request to fail. Any error in the application usually just crashes that one process serving that one request.
Philosophically, using erlang is trading consistency for availability. Given that it's easy to get good availability using normal applications connected to a database, using erlang is somewhat of a niche.
I have spent some effort learning erlang, and I really like it in many ways. I bought the new book and I like it so far. I have no problem with the syntax and I find it enjoyable to write in (though I haven't written any large programs). There are certain projects where I think erlang would be a great choice, like management and control of a cluster system. Obviously it works for telco-like things, too, but I've never developed anything like that.
Also, Erlang has long had an excellent reputation for performant, parallelizable code, but Go and node.js have stolen some of their thunder on that front. (I'm talking purely marketing-wise, I don't know enough to compare them technologically speaking.)
I'm not sure if "no platform / no package manager" really matters.
People first learn a language and get excited about it, and then if something irks them, they'll scratch that itch. It's like that famous de Saint Exupéry quote: "If you want to build a ship, don't drum up the men to gather wood, divide the work and give orders. Instead, teach them to yearn for the vast and endless sea."
The node.js ecosystem was absolutely awful at first, and the deployment story really only got fixed about a year or longer after the first release of NPM.
For me to seriously consider learning a new language/framework it should have:
Good documentation. Python is the gold standard. Good SEO for that documentation. Multiple good FREE learning resources, preferably with something useful being built. Good tooling (package manager, testing, etc)
Most importantly there should be a reason to learn it. For Node, I get easy asynchronous code. Clojure I get an enterprise-acceptable lisp. Go I get C-like performance + concurrency in an enjoyable language with modern tooling. Hell, learning Java allowed me to program for the Android.
Erlang? Well it's got some great concurrency and it's highly available. But I don't know anyone using it (and when I hear about it, it's usually because someone has stopped using it), it has a high learning curve and most of what makes it interesting can be found elsewhere.
Django made Python very popular.
There is no killer webframework for Erlang. However, N2O looks promising. [1]
Also, the learning curve: I took me half a day to be good enough in Python and years to learn the basics in Erlang. It is way more complex and the standard library is plagued with inconsistent/messy interfaces. (They say it is because of legacy code support or other BS.) But under the ugly surface lies the hidden beauty: single assignment is great when reading other people's code. Patching several running servers without stopping with one command is thrilling. Or the built-in nice abstractions for distributed programming like rpc:multicall [2].
[1]: http://synrc.com/framework/web/
[2]: http://erldocs.com/R16B03-1/kernel/rpc.html#multicall/3
Ask the simple question of how do you write the equivalent of
int main(....) { ... } and well... there isn't one!
You are almost forced, from the start, to learn about releases and a ton of other really complicated stuff just to write a program you can share. Its sort of being fixed with relx.
Secondly no one seems to understand pattern matching at first. Its just such an alien concept when you look at it compared to all the other mainstream procedural/oo languages people usually already know. Again a huge cliff to climb to really grasp the possibilities and usage.
It really is quite a great language, and an even better runtime. The learning curve to making great things with it is just quite high in my opinion. I've done two major projects with it, one shipped as an embedded web app in some lab equipment out there. I think it was a good choice!
main(_) -> io:format("hello, world").
- Ugly, yet simple syntax - Ugly OTP, yet powerful - emacs - Grumpy community, just like freebsd-dudes. - Isn't general purpose - Breaking meta on ever step: no loops, no variables, no strings, actors, recursions, no namespaces (i mean like in any popular language) - Nobody writes tutorials. - Poor library selection. Look at RoR, having 40 dependencies is okay there. - Situations like you do everything like in Basho's getting started for webmachine, and nothing is working - A lot of libraries that do the same thing, which is funny because it lacks of other libraries. Don't you dare ask community which webserver to use. - If you ask about IDE on erlang@c.j.r - almost instant ban, because, you know, trolling.
- Ugly, yet simple syntax - Ugly OTP, yet powerful - emacs - Grumpy community, just like freebsd-dudes. - Isn't general purpose - Breaking meta on ever step: no loops, no variables, no strings, actors, recursions, no namespaces (i mean like in any popular language) - Nobody writes tutorials. - Poor library selection. Look at RoR, 40 dependencies is okay there. - Situations like you do everything like in Basho's getting started for webmachine, and nothing is working - A lot of libraries that do the same thing, which is funny because it lacks of other libraries. Don't you dare ask community which webserver to use. - If you ask about IDE on erlang@c.j.r - almost instant ban, because, you know, trolling.
The driving force behind most of the new languages I have adopted; is a friend with experience who plants seeds, then can offer support and answer simple questions as I am learning. I have no friends that I know of who use Erlang.
That having been said, anybody who is serious about concurrent network programming knows about Erlang. The problem is that those people are far outnumbered by the people doing CRUD all the time.
1) It's hard to find people that have production experience with Erlang 2) The perception is that batteries are not included (even in comparison with Go... if you have some information to refute that notion I would be more than happy to learn more)
1. Erlang performance is not very good (forcing significant FFI usage which is a pain).
2. Debugging code which is a mix of Erlang and C is difficult
3. Weakly typed language seems unsuitable for larger projects.
4. Better interop with C++ or Java would be a plus.
5. The syntax I can see people complaining about but it didn't bother me.
It was a poor fit with our cloud-based infrastructure, and once the mnesia database began corrupting itself weekly, requiring a full rebuild, it was an easy decision to move to another solution for what we were using it for.
for example if you send a message to a process there is no way to know whether it actually received the message or not. if you wait for a reply from the process then you can tell if the process received your message AND processed it but sometimes you only want to do the first for performance as well as semantic reasons. for example you may not want to retry sending a message that has crashed a process. i think this is because erlang wants to be network transparent and with the network you obviously can't be 100% sure whether your message was received or not.
handling exit()s is a bit weird as well. you get a message which is like {'EXIT', pid_that_called_exit_or_the_pid_you_are_linked_to}. so you need to know who would call exit() on you to handle exits correctly (OTP assumes only your parent will call exit on you) or assume that you will know all your linked pids correctly at all times and if you get an exit for a pid that is not linked then assume it is for you. i think it would much cleaner if there was a way to differentiate between an EXIT from a linked pid and an EXIT from yourself.
It's not wasted, though. I use my knowledge of functional programming to write better, more stable programs in Javascript and C#.
The lessons of Erlang, of what can be achieved when one shrugs off the burden of state... are extremely valuable in scalable, concurrent programming - regardless of language.
somehow Haskell makes me feel bad about myself; like an ultra strict grade school teacher.
My wife is a web designer. She has no interest in programming. She taught herself PHP and javascript because she needed to use them. When she finally got to the point where she couldn't tolerate PHP's shittiness anymore, she asked me what she should use instead. I said "scala is a good choice, or you could just skip a step and go straight to haskell". She tried both, decided on haskell because she didn't like lift or play, and proceeded to teach herself haskell. She has never read real world haskell, or even learn you a haskell. I just asked her what a monad is: "Beats me, just use do and the arrow things". She's already finished two big websites written in haskell. This idea that you need to be a compsci phd or something to use haskell is simply not reality.
chunkWith :: ([a] -> ([a], [a])) -> [a] -> [[a]]
chunkWith _ [] = []
chunkWith f xs = let (h, t) = f xs in h : chunkWith f t
i'm sure that many here merely glance at that and understand it immediately. but as i typed above, it somehow makes me feel bad about my own stupidity. (no need for anyone to explain specifically what this tiny example does, (i actually happen to understand this one). the goal here is to admire the immediate obviousness of the syntax ;))
http://wagerlabs.com/blog/2006/01/01/haskell-vs-erlang-reloa...
However, I cannot build any high-availability and or high-performance system based on it because it lack community around it. I.e., if something stops working there is very little resources or support - I'm not even sure if anybody tried or tested that.. So it is chicken and egg problem :(
It offers few, if any, of the advantages of being a JVM-native language. (e.g. java interop)
Personally, I'm willing to try a new unusual language if there's some killer feature, but I haven't heard much about Erlang at all. What incentive is there to put in the extra effort if there is no perceived benefit?
Longer answer: The only proper way to learn Erlang is to read the documentation. Then re-read the documentation. All of it. It takes 3-6 months to get proficient, then another 6 months to stop doing things the native or outright bad way.
If you are primarily an "erlang programmer," you can't interview for jobs. Everybody hires for either java, ruby, or python. If you do see a rare "Erlang job" position, they probably actually mean "We want you to understand ejabberd because we based our company around it and it's actually unusable at scale, so you get to fix other people's problems all day long." (Of course, building your own company/services around Erlang stops the "need to interview in other languages" problem.)
But, why can't you interview in Erlang? I guess you can, but the way I work, I have an editor in one window and API docs in the other. Interviewers, sitting up there on their oh-so-high perches, don't like it when candidates want to do quick API lookups for things like parameter order or return values. (Does it take (Fun, List) or (List, Fun)? Does it return Value or {ok, Value} or {value, Value}?)
Short conclusion: Erlang is a system and understanding systems takes effort and practice. People, in general, don't want to learn, they want to do. It's the whole "one year of experience 15 times over" instead of 15 years of growth and advancement problem. It's the "person with 20 years in computing can't write a tail recursive function" problem. It's just a problem.
Alternative question: why don't people understand defmacro (and recursive defmacro) and write their programs from the bottom up?
Bonus analysis: In a world where people just want to learn one thing and use it forever, Erlang doesn't fit. With Python, you can learn it once then keep "extending" it to pretend to get concurrency and other fancy features Python actively rejects at the implementation level. So, you learn Python once, then feel productive because you're duplicating functionality given to you for free in other languages.
Erlang has so much "done right the first time" built into its VM you don't have to reinvent basic parallel computing every time you want to get two webpages at once or serve more than one client at a time from a basic five line server. But—Erlang people know for other tasks, say something better served by numpy, they should jump over to Python or Lua or something else better suited to the task without reimplementing all of the "they did it right the first time" code in Erlang just because they refuse to learn any other language.
Do you have a source for that? I'd love to read more
https://blog.whatsapp.com/index.php/2012/01/1-million-is-so-...
http://blog.whatsapp.com/index.php/2011/09/one-million/
http://www.erlang-factory.com/upload/presentations/558/efsf2...
Perhaps those would make a good starting point?
Um... it's not easy to get 2-3million they did it but they also profile the crap out of it.
I think they easily got 1 million out of the box though.
1. It doesn't fill a pressing need
2. It has foreign syntax
3. It's hard to tell if it has familiar semantics (due to #2)
Credentials: I looked at some Erlang sample code twice and haven't looked at it again since; also, I'm no stranger to new languages, I fully adopted Clojure within a month of learning it
Another issue is that a lot of languages are bringing Erlang's best feature (actor model concurrency) via libraries or into their core, so it makes me less interested in pursuing Erlang.
Performance was focused solely on throughput, latency was terrible for anything requiring even modest computation. Finally dropped it after rewriting a naive Clojure implementation of something that ran 8x faster than the Erlang version.
This comes from reading rabbitmq and riak-core sources.
---------------
Well, I guess only the first part of that is true now. :p
But yeah: Why not Erlang?
I haven't seen a good pitch for it that addresses anything we're interested in.
Erlang's big thing seems to be that it scales. We don't have that as a major problem for our programming. If we did, I imagine I'd be interested in quantitative comparisons with other programming languages for similarly advanced code, (i.e. I wouldn't want to read some ungodly shitfest alongside decent code as the argument that Erlang was better.)
To be convinced from that perspective, I'd have to:
A) Know ahead of time that we were going to be in a position where we'd need that sort of optimisation
B) Know, or strongly suspect, that we wouldn't have to expend more effort learning Erlang than we would optimising it to 'good enough' performance in another language.
C) Be assured that I'd be able to hire sufficiently intelligent programmers who knew, or were willing to learn, Erlang to maintain things if I set up in it.
That seems a rather niche position to be in requiring both a very strong pitch for that advantage on the part of Erlang, and a significant degree of foresight on my part. If it takes six months to a year to gear up for starting a decent Erlang solution, we'd best be expecting to do massive systems engineering fairly frequently as compared to writing the solution in something that we know right now for that to pay off.
People may say that it's trivial to implement what's missing in Erlang, as compared to the systems side of things that's missing in some already known language. That may be true, I don't pretend to know enough about it to comment on it. However, even if it's so, is it sufficiently harder to implement something that scales out to the required efficiency in Known-Language-X than it is to learn Erlang to that level? Especially given that there's probably already community support for scaling in Known-Language-X.
#
It does seem to have some other nice features. But from that perspective - and this was my first response on dipping into Learn You... I look at it and think 'This looks kinda like Haskell. Why not use Haskell?' or, as the case may be, 'Why not Lisp?' Both of which I've some experience with and would be easier to find good programmers for.
In that regard Erlang is competing with some damn powerful languages.
That is spelt "très", not "trés".
It's the language (somewhat Prolog-ish) that is weird and uncomfortable to people new to it. Elixir helps with this, but still, every time I've tried to pick up Erlang I've rapidly been turned off.
It's the community--rather, the lack of one. Right now the product I'm working on pretty much plays directly to the strongpoints of Erlang: high-availability, high-scalability, soft-realtime performance, and straightforward error handling. Should be an obvious play.
But, I can't find Erlang developers where I live--which is funny, because at least one company with a good exit in town is an Erlang shop.
Maybe we'd be better off trying to open a branch somewhere in Europe to poach ex Ericcson folks. :(
EDIT:
More thoughts.
Prototyping is just a hell of a lot faster in JS/Ruby than in Erlang, though this could be a side-effect of it being a lower-level language more suited to infrastructure stuff. Then again, I've seen at least one 3D modeling package written in it ( Wings3D ).
Maybe that's part of the problem: just what the hell is Erlang good for? I see it used for really hardcore systems stuff, but it also seems to want to serve web pages, and draw 3D objects, and orchestrate builds, and all these other things. It doesn't seem to have a clean focus in the public eye right now.
I don't think my experience with erlang has anything to do with the reasons it isn't more popular though. The biggest thing I see is the lack of module/library/package management. CPAN was a big deal. It is now expected that every language have their own CPAN. I think the lack of one is a huge problem for any language, erlang being a good example. I think it is also a big reason that ocaml and haskell went from being "ocaml is the more commonly used one" to "haskell has ten times the userbase of ocaml".
I love reading all these posts about new cool-kid concurrent languages when Erlang has decades of maturity and a sophisticated scheduler that kicks the shit out of go/rust/scala/insert cool new thing.
Source: I've used it professionally and its my language of choice
Elixir is the solution.