Programming Erlang
gnalre writes "Every day it seems there is a new publication of a book on perl/python/ruby. Some languages however do not seem to get that sort of attention. One of those under-represented languages is Erlang, however for the first time in 10 years a new Erlang book has been published. As someone who had a brief flirtation with Erlang long ago, I was interested to see how the language had evolved in the intervening decade. I was also curious to re-evaluate Erlang to see what solutions it offered to the present day issues of writing reliable distributed applications." Read on for the rest of Tony's review.
Programming Erlang - Software For A Concurrent World
author
Joe Armstrong
pages
515
publisher
The Pragmatic Programmers
rating
8/10
reviewer
Tony Pedley
ISBN
1-9343560-0-X
summary
Parallel programming the easy way
Programming Erlang — Software For A Concurrent World (ISBN 10193435600X) is part of the pragmatic programmer series. As with all the books in this series, it is available in paperback or for a reduced cost you can directly download it in PDF format (which is always useful if you spend a lot of time on the move and you do not like carrying around a dead tree with you). The book's format and layout as with all the books of this series are clear and logical.
The book is written by Joe Armstrong, who co-authored the first Erlang book a decade ago. He was also one of the originators of the Erlang language and has been directly connected to its development ever since. We can therefore be assured about the author's knowledge and insight into the language, if not his impartiality.
The book itself can be roughly split into three main sections: Getting started and Sequential programming, Concurrent Programming and Erlang libraries and advanced Erlang techniques.
In Chapter 1 the author sets out his stall of why Erlang is worthy of your attention. It's clear from this chapter that the author feels Erlang's strength lies in applications requiring an element concurrency and fault tolerance. Another emphasis is made of running Erlang on modern multi-core processors, something that was only a glint in a hardware designer's eye 10 years ago, but is rapidly becoming an issue in all areas of programming. From this chapter you also get a feel on how the author approaches his programming in that he states that he wants the reader to have fun with the language, which is a refreshing change to some language text books whose main purpose appears to be as a cure for insomnia.
Chapter 2 goes through installing Erlang and the Erlang shell (a command line environment similar to ones with languages such as perl). The chapter also starts us into the strange world of functional programming, where variables can only be given a value once (e.g you cannot do i=i+1), recursion replace loops and pattern matching replaces assignments. Fortunately the Erlang language is remarkably concise. For example there are only 4 data types. However to those coming from a purely procedural programming background the learning curve could be a steep one. Saying that the Author does a good job of leading you through the languages intricacies with examples being compared to code from languages such as Java to help keep your feet on solid programming ground.
The next 3 chapters move on to writing simple Erlang programs. As a quick aside, for anyone new to Erlang it is well worth examining the quicksort implementation described in chapter 3. Its conciseness and simplicity was one of the reasons the language won me over when I first met the language.
These chapters also cover error detection and handling. It's worth noting that Erlang has a philosophy of ensuring programs fail hard, so that bugs can be weeded out at an early stage. This idea very much defines how Erlang error handling is defined.
One criticism of the first section is Chapter 6, which describes compiling and running an Erlang program. I would have preferred that this information be covered earlier in the book or be placed in an appendix because it is probably an area you will want to reference repeatedly.
Chapter 7 is where things really get interesting and the true power of Erlang starts to come to the fore. This is where Erlang's concurrency credentials are explained. This chapter begins by providing some useful metaphors of the Erlang concurrent model, but chapter 8 is where the fun begins by describing the Erlang concurrency primitives that allow the creation of processes and the process communication methods. The author here highlights one of the language features, the Erlang light weight process. These are true processes (not threads) but take up very little in the way of resources. Indeed it is not unusual to have 1000's of such processes running in an application.
The next few chapters expand on the available concurrency primitives and how to move from concurrency on your local processor to concurrency utilizing the resources of multiple machines either on a local network or across the web. It finishes the section off by showing the example of a simple IRC application.
Chapter 12 starts the next section by looking at how to interact with the world outside the Erlang environment. First it examines how to interface an Erlang program to applications written in other languages such as C. It then goes onto to look at file and socket handling in Erlang. Chapter 15 looks at two important Erlang storage primitives ETS and DETS before we get to the OTP Erlang libraries in Chapter 16.
The OTP libraries are the standard Erlang libraries and tools. In fact the OTP libraries are worthy of a book in itself. The author highlights the section on the generic Server module as the most important section in the whole book and one to be reread until its importance has sunk in. This is because here are encapsulated many of the lessons learned in writing industrial fault-tolerant applications, such the updating of a running applications code without causing that application to miss a beat. The section is finished off by describing the Erlang distributed database (humorously named Mnesia) and then finishing it off with the example of a simple server application.
The book finishes off by looking at Erlang on multicore systems including its support for SMP. As the author states this is the leading edge of present day Erlang and is still under development.
I would like to thank the pragmatic programmers for publishing this book. Erlang's profile has been in need of highlighting for many years and hopefully this book will help. The book definitely provides a great starting point for anyone who wants to get to grips with the language and takes them to the point where they can start writing useful applications. This book is a worthy successor to the last book published and does a good job of both updating the material and explaining some of the later developments such as SMP. Anyone who has a need for writing fault tolerant applications should at least look at this book. If nothing else you will never be afraid of dealing with recursion ever again.
In many ways the book cuts off just when things are getting interesting. There are hints in the book about real world Erlang's applications and it would have been good if some of these experiences could have been expanded. Hopefully this book is the start of increased exposure for Erlang. If so then someone may get around to writing another Erlang book describing some of the advanced issues about generating robust applications. I just hope it won't take another 10 years this time.
Tony Pedley is a senior engineer specializing in real-time embedded systems. In his spare time he likes to tease windows programmers and confuse managers by telling them it would be a lot easier if we wrote it in Erlang.
You can purchase Programming Erlang - Software For A Concurrent World from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
Programming Erlang — Software For A Concurrent World (ISBN 10193435600X) is part of the pragmatic programmer series. As with all the books in this series, it is available in paperback or for a reduced cost you can directly download it in PDF format (which is always useful if you spend a lot of time on the move and you do not like carrying around a dead tree with you). The book's format and layout as with all the books of this series are clear and logical.
The book is written by Joe Armstrong, who co-authored the first Erlang book a decade ago. He was also one of the originators of the Erlang language and has been directly connected to its development ever since. We can therefore be assured about the author's knowledge and insight into the language, if not his impartiality.
The book itself can be roughly split into three main sections: Getting started and Sequential programming, Concurrent Programming and Erlang libraries and advanced Erlang techniques.
In Chapter 1 the author sets out his stall of why Erlang is worthy of your attention. It's clear from this chapter that the author feels Erlang's strength lies in applications requiring an element concurrency and fault tolerance. Another emphasis is made of running Erlang on modern multi-core processors, something that was only a glint in a hardware designer's eye 10 years ago, but is rapidly becoming an issue in all areas of programming. From this chapter you also get a feel on how the author approaches his programming in that he states that he wants the reader to have fun with the language, which is a refreshing change to some language text books whose main purpose appears to be as a cure for insomnia.
Chapter 2 goes through installing Erlang and the Erlang shell (a command line environment similar to ones with languages such as perl). The chapter also starts us into the strange world of functional programming, where variables can only be given a value once (e.g you cannot do i=i+1), recursion replace loops and pattern matching replaces assignments. Fortunately the Erlang language is remarkably concise. For example there are only 4 data types. However to those coming from a purely procedural programming background the learning curve could be a steep one. Saying that the Author does a good job of leading you through the languages intricacies with examples being compared to code from languages such as Java to help keep your feet on solid programming ground.
The next 3 chapters move on to writing simple Erlang programs. As a quick aside, for anyone new to Erlang it is well worth examining the quicksort implementation described in chapter 3. Its conciseness and simplicity was one of the reasons the language won me over when I first met the language.
These chapters also cover error detection and handling. It's worth noting that Erlang has a philosophy of ensuring programs fail hard, so that bugs can be weeded out at an early stage. This idea very much defines how Erlang error handling is defined.
One criticism of the first section is Chapter 6, which describes compiling and running an Erlang program. I would have preferred that this information be covered earlier in the book or be placed in an appendix because it is probably an area you will want to reference repeatedly.
Chapter 7 is where things really get interesting and the true power of Erlang starts to come to the fore. This is where Erlang's concurrency credentials are explained. This chapter begins by providing some useful metaphors of the Erlang concurrent model, but chapter 8 is where the fun begins by describing the Erlang concurrency primitives that allow the creation of processes and the process communication methods. The author here highlights one of the language features, the Erlang light weight process. These are true processes (not threads) but take up very little in the way of resources. Indeed it is not unusual to have 1000's of such processes running in an application.
The next few chapters expand on the available concurrency primitives and how to move from concurrency on your local processor to concurrency utilizing the resources of multiple machines either on a local network or across the web. It finishes the section off by showing the example of a simple IRC application.
Chapter 12 starts the next section by looking at how to interact with the world outside the Erlang environment. First it examines how to interface an Erlang program to applications written in other languages such as C. It then goes onto to look at file and socket handling in Erlang. Chapter 15 looks at two important Erlang storage primitives ETS and DETS before we get to the OTP Erlang libraries in Chapter 16.
The OTP libraries are the standard Erlang libraries and tools. In fact the OTP libraries are worthy of a book in itself. The author highlights the section on the generic Server module as the most important section in the whole book and one to be reread until its importance has sunk in. This is because here are encapsulated many of the lessons learned in writing industrial fault-tolerant applications, such the updating of a running applications code without causing that application to miss a beat. The section is finished off by describing the Erlang distributed database (humorously named Mnesia) and then finishing it off with the example of a simple server application.
The book finishes off by looking at Erlang on multicore systems including its support for SMP. As the author states this is the leading edge of present day Erlang and is still under development.
I would like to thank the pragmatic programmers for publishing this book. Erlang's profile has been in need of highlighting for many years and hopefully this book will help. The book definitely provides a great starting point for anyone who wants to get to grips with the language and takes them to the point where they can start writing useful applications. This book is a worthy successor to the last book published and does a good job of both updating the material and explaining some of the later developments such as SMP. Anyone who has a need for writing fault tolerant applications should at least look at this book. If nothing else you will never be afraid of dealing with recursion ever again.
In many ways the book cuts off just when things are getting interesting. There are hints in the book about real world Erlang's applications and it would have been good if some of these experiences could have been expanded. Hopefully this book is the start of increased exposure for Erlang. If so then someone may get around to writing another Erlang book describing some of the advanced issues about generating robust applications. I just hope it won't take another 10 years this time.
Tony Pedley is a senior engineer specializing in real-time embedded systems. In his spare time he likes to tease windows programmers and confuse managers by telling them it would be a lot easier if we wrote it in Erlang.
You can purchase Programming Erlang - Software For A Concurrent World from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
Dupe?
The first chapter is avalable online to get a taste of the book (and the language).
When the only books about a language are written by the inventor of the language, there is probably a reason. And that reason is: No One Cares.
I bought the book while it was still being written. I was able to download drafts, and (if I had the time) submit bug reports. When it was finally done, I got a printed copy in the mail.
I haven't had much time to play with Erlang (or the book) yet, but it was a really nice feeling to be able to get early access as long as I was willing to see unpolished content. Bravo, publisher.
Last I checked, there was an implementation issue and a design issue.
The design issue, for me, was a lack of namespaces. I think it might have been that I can't have an atom with a namespace, beyond prefixing, which is a hack for languages that don't support namespaces.
The implementation issue was that you had to choose between performance and being able to reload functions later. I would very much like it to be able to JIT or even compile down to binary (x86_64 too, pretty please?), then be able to just leave it running, and have it reload functions as needed.
I'll have to think of what else I didn't like, but I don't think there was much, aside from some odd syntax. I don't actually have a problem with the somewhat functional nature of it, just certain syntax that looks ugly, but that's a matter of opinion, and something I can live with.
Don't thank God, thank a doctor!
Perhaps it should have been given another name than a common statistical probability distribution (for some reason people who explore new programming languages are often interested in math and may therefore mix things up)
http://en.wikipedia.org/wiki/Erlang_distribution
It shares half a shelf with the Standard ML and Haskell books. The other half taken up by the shrink wrapped "The Art of Computer Programming" that has been sitting on there since the store opened.
Contrary opinion: The Seven Deadly Sins of Erlang
The Ericsson Language, for those who have not been exposed to it, is a programming language meant to make concurrent (multi-process, multi-processor, multi-machine) programming really simple. It's used on many AXE telephone base stations world-wide. It has great message-passing support, and a pretty nice library. It is actually not a functional language, but a logical one. Basically a perverted version of Prolog.
I choose to remain celibate, like my father and his father before him.
This book is written by the language's creator, Joe Armstrong, and provides one of the best introductions to a programming language I've ever seen. The entire approach is nicely bottom up, with the idiosyncrasies of the syntax presented immediately so they are not confusing later. More powerful features are introduced, such as the tools for concurrent and distributed programming, with the book finishing off with the immensely powerful Open Telcom Platform and its associated tools, such as the "one server to rule them all" gen_server implementation and Erlang's distributed database, Mnesia.
All in all this is an excellent book about an excellent language and I would highly recommend it to any programmer, especially those concerned with the multicore future which will increasingly demand concurrent programming languages.
Strange that I didn't see Wings3D mentioned yet. ( http://www.wings3d.com/ )
It's an open-source subdivision surface modeler held to great esteem in the modeling scene
It is also an Erlang application....
And in my opinion; If you are familiar with more common languages like C and Java you should take a deeper look into Erlang unless you prefer to study Prolog or Cobol. Just take a dip or a deep plunge, you never know when you end up in a project where knowing Erlang may prove useful - it is actually developed to be used in real applications and not as a theoretical study object.
And Erlang is designed to handle concurrent programming from the bottom, which is a real problem in large multi-user systems. You can of course use C or Java and solve concurrency problems with semaphores or synchronization, but the solution in Erlang may be much more elegant.
And for all of you that are familiar with the Eclipse development environment; There is a plugin called Erlide.
If builders built buildings the way programmers wrote programs, then the first woodpecker would destroy civilization.
Me, too.
...usually a glitch in the google grid. It happens when they change something.
"Hannibal's plans never work right. They just work." Amy/A-Team
I pulled this example from Wikipedia:
The first block of code is easy to understand. The second block, whoah, I guess I just have to take your word that it does the same thing as the first block. Can someone give me an introduction/explanation to Erlang / functional programming that I can understand? At this point, I don't even understand what situations this could be usefully applied to.
It seems interesting though...
My vote for best introduction-to-programming book goes to Structure and Interpretation of Computer Programs (a.k.a. The Wizard Book) by Hal Abelson, Jerry Sussman, and Julie Sussman.
Saying that the Author does a good job of leading you through the languages intricacies with examples being compared to code from languages such as Java to help keep your feet on solid programming ground.
Beware of bugs in the above code; I have only proved it correct, not tried it.
I had my first encounter with Erlang at a Ericsson presentation back in 1994. It's amazing that more than ten years have passed since then, and only now is the language becoming more mainstream! This new-found attention is well-deserved, however: Erlang will feel right at home in those +80 CPU cores on the horizon...
As for other less conventional languages, OCaml also definitely deserves a look. It is functional, though also allows imperative features; it has a powerful module system, but also supports object-oriented programming; it has a certain academic feel, but real-world performance (check the shootout if you want: it's among the fastest ones, comparable to C++) and a very good and comprehensive repository of libraries (even for low-level stuff!). Definitely one of the best things to come out of France in recent memory!
the new programming language du jour.
Overall, the book is very good: the examples are clear and useful, and for an old Prolog programmer like me, Erlang has a natural feel to it.
I have been disappointed that none of my customers seem to be interested in Erlang development - I proposed using it for one application where 'share nothing' asynchronous communication seemed like a very good fit.
If you program in Erlang you will look like these guys. (Oh, and I think these people actually believe that it is a good idea to allow modification of code directly in production environment. I think a library can be written explaining why this is a dumb idea.)
You can't handle the truth.
Programming Erlang is the best intro-to-new-programming language book I've ever read. By far. While erlang is radically different than previous languages I've learned, this book goes a long way to making the transition smooth.
I'm still struggling, but I read the book with an application in mind, and have found its coverage is excellent... it brings you right up to the point that is needed for the other erlang documentation to be readable. (There are 60 some odd books on all the major components of erlang and OTP, including the major modules and APIs... they are downloadable from erlang.org)
So, this book accomplishes its goal and really well. ITs not a shallow marketing piece about the language (as most books written by writers rather than programmers are) its a real how-to-program in erlang book and it does a great job of showing how you solve very difficult problems in erlang. It even has as examples things like full text indexing and map reduce.
I think every programmer worth his salt should buy this and learn erlang-- the days of single core computing are over, and thus concurrency oriented programming is a critical skill to pick up, and erlang is the best language for it.
Yeah, and you guys panned the ipod too: http://apple.slashdot.org/article.pl?sid=01/10/23
Would a good analogy be that an Erlang process is comparable to an object instance, in that both are loosely coupled (ideally), focused on one task (ideally), but in Erlang they're all running asynchronously and the OS/runtime automatically handles the communications for you?
Chip H.
"Hannibal's plans never work right. They just work." Amy/A-Team
A great book on Erlang, but missing a few details on the usage of common libraries. In particular it could do with more information on how to drive the Mnesia database. I started programming Erlang a month ago and the shortage of implementation docs on the database and list libraries has been a problem for me.
:v)
Yes, I do know about the Ericsson Mnesia manual and http://trapexit.org/
Vik
It's worth noting that ejabberd is written in Erlang.
For those who haven't heard about it, it's an open source, distributed, fault-tolerant instant messaging server (Jabber/XMPP), modular and very configurable and is readily available in most Linux distributions' repositories.
It's one of the most promiment erlang-based projects.
...YAWN...
It's worth looking at
h p?test=all&lang=hipe&lang2=hipe
http://shootout.alioth.debian.org/gp4/benchmark.p
for the general performance of erlang. It compares unfavorably in those tests to lisp and clean, two other functional programming languages.
Use the Firehose to mod down Second Life stories!
As somebody writing code in Erlang as a profession, I say, though it has strength, it's crap. It has strength in the efficient handling of many processes (faster then the OS when there are many many thousands of them), aand (re)loading modules on the fly into the virtualmachine is nice. But on the flipside Erlang is slow as it's a very high level language, with a not so clever virtual machine - much less so than java vms (well I have to admit I am an assembly&C fan). Also functional programming my ass. In reality it's more like very basic barebone declarative programming, where you can only use global variables (mnesia database, and in worse cases the process dictionary) and there are no loop constructs (you can only use ugly additional functions and recursion instead of a "for" construct). Well, at least this is my opinion.
to give you an example of something built in Erlang take a look at http://www.couchdb.com/ CouchDB is an Open Source (GPL) database back end. It is in some ways inspired by the database architecture of Lotus Notes, it is a non-relational document based store with strong replication ability. Don't bother bitching about Notes, the new UI is quite different to the old look (personally I liked the old style) but CouchDB doesn't have a UI, it has similarities at the architecture level which is where Notes is very very good indeed, and CouchDB is better.
I'll have to check it out again.
What are the options for compilation? Anything beyond simply distributing source code?
Don't thank God, thank a doctor!
Seriously, is it? Because those criticisms are pathetic, and two contradict each other.
I'd actually like to read a serious criticism of Erlang. I finished "Programming Erlang" on Sunday, and like many folks, I'm mildly jazzed about Erlang. The syntax hurts somewhat, but then again I spend all day coding Python. And while I can think functionally somewhat, I have a hard time imagining larger systems without OOP, but that's probably my lack of experience.
I'm ready to do something good with Erlang, but I'd like more contrary opinions before I do so.
(The book was outstanding--a pleasure to read.)
The "download PDF first, get dead tree later" approach is a huge winner for tech books. I did the same with "Programming Erlang," and it allowed me to get through the first few chapters on my iPhone (Safari does some magic that renders PDF very well), then read the rest on paper. Then I read Chapter 8 online again because I'd left the book home. Very convenient, and closer to Instant Gratification.
I'm probably not the only one waiting (and waiting...) for djangobook.com to get published finally, but a 2/3 finished PDF would have made me 2/3 happy in the interim.
It's very different, but the big advantage is that it's higher level than the stuff you confess to understanding better.
The code in question (in Python? not a great choice for doing an example!) uses two very common higher-order operations in functional programming: map and compose. A map operation takes a complex data structure (most common example: a list), and a function that applies to elements of that data structure, and returns another structure, with the same "shape," where each element in the result is related to its corresponding element in the original structure by being the result of apply the function. Thus, if you have a list [2, 3, 5, 7], and a function inc that increments a number by one, map(inc, [2, 3, 5, 7]) evaluates to [3, 4, 6, 8].
In the case of a list, map is can be implemented by creating a new list of the same length as the original, looping over the list, applying the function to each value, and storing the result in the result list. This is a kind of task that imperative programmers find themselves doing all the time. The problem with this, however, is that if you're writing code like this all the time, you're writing at a much too low level, with the all the disadvantages of that:
Are you adequate?
live code updates are an up-front requirement for the domain Erlang addresses. Google "nine nines" if you don't understand why.
I must assume it's actually trivial and obvious.
Here is a classic paper on the style and advantages of functional programming:
m l
u s.pdf
http://www.math.chalmers.se/~rjmh/Papers/whyfp.ht
Also, John Backus' Turing Aware lecture, "Can Programming Be Liberated from the Von Neumann Style?"
http://www.stanford.edu/class/cs242/readings/back
Whatever it will be - Erlang or Scala, functional languages are getting more demand. No wonder. If you've been developing large information systems that must scale and be reliable (by definition) you already know why. In year 2007 it's a new "java" indeed. And for the first time in the last 10 years, I was finally having a huge fun learning new programming language. Great author, great book, great language.
Gamingmuseum.com: Give your 3D accelerator a rest.
"Last" as in "most recent", not "last" as in "ultimate" or "final."
Program Intellivision!
An article on functional programming is the perfect time to introduce my new son, Nick, to Slashdot. Previous releases were in C, Perl, and Python. Since Nick's functional, this one is in Lisp.
Mod me up or my son will spit up on you.
Dewey, what part of this looks like authorities should be involved?
For my bachelor's I was required to take a Programming Languages course. Unfortunately, I'm finding many other students that went to other universities don't have the same requirements or the same type of professor I had.
The course covers different areas of programming languages: imperative (C, Perl, basic), object oriented (C++, Java, Smalltalk), functional (lisp, scheme), and logic (Prolog). My professor did the smart thing (or the thing he liked the most if you want to look at it from another perspective) and started the course by teaching Prolog. Everyone up till this point had been exposed to imperative and OO programming styles so Prolog even for me was very new. But it made the other thing CS students cringe on much easier. That other this is pure functional languages like pure Lisp and pure Scheme.
Very briefly, Prolog is a logic based language. What you're used to and what most of the world uses is some mixture of imperative programming and OO programming (though that's slowly changing). In those types of languages it's basically like coming up with a set of steps to execute in order to perform some operation of algorithm; you think in the order in which you would perform the operation most of the time. Prolog is completely different. Instead, you take a more mathematical approach and come up with a set of rules. A common problem that's easily solved in this manner is explaining a family tree with a grandparent relationship. In a logic based language, the procedure is something like:
Once that's completed, then you "ask" the program for rules that are true and it should return true or false. So in the above examples, I could ask "is John a grand parent of Amy, and prolog would return true, and I could also ask "is John a grand parent of Jane, and prolog would return false. There was never an instance of the programmer defining anything except logic based rules. However, because of this, the program can now answer all questions that fit within that set of rules. As you might imagine, when you are trying to implement not so trivial things like sorting lists, logic based programming gets really strange to think in.
But that strangeness pays off because at some point you will have learned essentially what you needed to get by in functional programming: recursion. Everything in functional programming is done by recursion and as you might guess functions. In "pure" functional programming, there is no such thing as a "variable". All functions operate on a list data structure with functions that only allow you to access the head item the next item because by definition, you could just keep taking the next item to traverse the list. Functional programming isn't actually that bad once you've gotten your head over how to use recursion to replace almost any loop.
For example lets take adding all the numbers in a given list with only functions. In the imperative style you'd probably use an accumulator just as you normally do when you physically add numbers:
However in functional programming, we have no variables and we have only have functions. Therefore, we need to define what it means to add the numbers in a list using functions and recursion:
Psuedo code aside, all I have are two functions, the first is basically the definition of addition. The second is the definition of adding numbers in a list in terms of recursion. In English, that is: the sum of a list of numbers is the first number in the list plus the sum of the remaining list of numbers.
Re
Oh my god, that's the funniest thing I've read today. "COSA killer." Duke Nukem Forever, dooood!
Erlang sucks nuff said. Posting as Anonymous Coward is the only way to get any sort of modding. If it's flamebait so be it. You moderators suck!
Ocaml doesn't support true concurrent programming. Threads in Ocaml will only run one at a time, even if you have 80 cores. Apparently, it's a deficiency of the garbage collector they use. Jocaml is an Ocaml extension to support concurrent and distributed programming. Speed-wise, wasn't there some controversy over the benchmarks testing more of the performance of Ocaml's imperative features rather than its more interesting functional programming features?
I've put some thought into this particular topic a while ago. I wondered what it would be like to have a computer language that didn't use english (or any human language) tags for it's keywords. The thinking was, what is easier to read or write: 1 + 2, or 1 plus 2? To me, the symbol form seems more natural.
An example of using symbols where you would normally have a keyword is in C's conditional expression, " x y ? z : n ", which is read as "(if) x y (then) z (else) n". What if this syntax was used wherever an if/else pair is used, would it be more readable? And, can it be extended to loops, so that you had an iterative inline conditional, such as "x y ?? z : n", which is read as "(while) x y (do) z (else) n", where the "else" clause is executed only if the initial condition started off false. So the entire expression returns eiter the final result of z, or n in the case that z never gets evaluated.
So to try this out, I started putting together an interpreter that used this syntax (it's on lang2e.sourceforge.net if any one is interested). So far it seems to be working out ok, but the one area that I couldn't get away from using english keywords is in the standard function library. But technically that isn't part of the core language definition, but it is included with the base interpreter.
It's still a pretty minor point, because it's really easy to write functions like map, to understand them, and to unit test them. In fact, this makes the functional program easier to debug. When you split out your "looping" into a generic higher order function to provide the structure, and an argument functions to provide the case-specific logic and transitions, you can test them independently.
Are you adequate?
With "threads" or "processes" to do every little task, you might end up with hundreds of these things racing against each other. These "processes" need coordination. What control mechanisms does Erlang offer to prevent race conditions?
I am (well, was, at least) an Erlang Programmer. I was toying around with Erlang for some small projects with distributed programming.
I've been looking forward to Joe's book for a long time, as he's one of the few big names in the Erlang community, and has done a lot of work (both code and, even more importantly, documentation) for the community -- first that jumps to mind is his important look at Yaws vs. apache.
There are serious problems with the Erlang language as a whole and the community, right now. The mailing lists are actually pretty good, but quite frankly, the documentation online is terrible and the Erlang interpreter is pretty rudimentary. Not to mention basic problems with the syntax and grammar of the Erlang language itself. When I was learning Erlang a few months back, I was pretty frustrated that about the only source of documentation was on erlang.org, and they.. weren't great. For instance, there needs to be a big warning right at the beginning explaining that atomic values always start with a lowercase letter and all other variables must begin with a capital letter. This must be a huge problem for other beginners (at least, I hope I assume I wasn't alone..) compounded by the unfriendliness of the error messages produced by the Erlang interpreter.
Now that I've switched over to doing as much as I can in Python, which has a great user community, wonderful docs, a healthy standard library, and a reasonably helpful interpreter.. I don't really worry about Erlang that much anymore. It would be wonderful if I could write, say, web crawlers (I work in web security) in Erlang. But the mysql support in Erlang looks alpha-quality at best, and AFAIK there's nothing even remotely similar to Python's urllib2 for basic web client functionality in Erlang.
I think it says a lot that so much attention is paid to a language that is so rough around the edges, unfriendly, and lacking in documentation. Even given all that.. the ease of use of the concurrency and message passing in Erlang is so fantastic that it almost makes up for the rough spots.
On a final note, I'd like to point out to anyone interested that I think there's a huge void out there for a language that's as easy to use and learn as Python, but with the concurrency and message passing in Erlang. It actually might not take that much work to build a network-transparent message passing interface as a Python module (I've looked into Pyro a bit.. it looks rather cumbersome and makes easy things too hard, correct me if I'm wrong). Also, modern languages need basic support for splitting up the workloads of map() or similar trivially parallelizable functions across multiple processors/cores (I know the Perl6 group was thinking about this.. not sure if this works in Parrot now or what). Basically, modern languages like Python/Perl/Ruby should really think more about making simple modules to mimic the message passing that Erlang has. Really, a little bit of code could go a long way. The Google team put together sawzall which looks kind of cool, on this note..
http://cltracker.net -- powerful craigslist multi-city search
I can only assume you meant that sarcastically. That archaic and non-relevant book almost turned me away from CS. It was the worst textbook I encountered in college. I held on to several of my textbooks from college, but this one went in the trash.
Protect your browser with the Force Safe Search add-on
I think SICP is a good book, but some people don't think it's good as an introduction:
The Structure and Interpretation of the Computer Science Curriculum
Erlang does not stand for Ericsson Language, it's named after the Danish engineer Agner Krarup Erlang. They say the duality is intentional, though.
xkcd is not in the sudoers file. This incident will be reported.
I use Erlang everyday in my support role for a mobile network, and i have to say i think it's fantastic. It's concurrency is very good, its stability is very good (our applications aren;t allowed to die...) and the fact we can load patches for new service functionality without even taking the application down is invaluable.
I'm amazed its use isn't more widespread. There's probably nearly 200 servers here running various Erlang applications. The amount of data these apps have to process is barely believable for the hardware they run on.
Why do Haskell, Erlang, Prolog, etc abandon the clean, easy-to-understand syntax of LISP? I was reading "Beautiful Code" and saw some Haskell and it looked like a mess just visually to the naked eye. A while back I tried to install a package written in Erlang and thought it was kind of ugly too. I wonder why the FP side of the universe hasn't stuck with the simple, clear syntax of LISP. The structured/OO side of the universe has standardized on C syntax (C, C++, C#, Java, Perl, etc etc etc) which may be quirky (like LISP is) but is standard and anyone who knows one can follow along code in the other. I know Common LISP and Scheme, but was so baffled by Haskell I wondered if the syntax was serious or a FP equivalent of INTERCAL. Some of these FP languages are incredibly marginal because they're inscrutable even if you've had some background in functional programming with LISP.
It's about time, that someone posts a link to "Erlang, the Movie"! So here it comes:
http://www.youtube.com/watch?v=uKfKtXYLG78
Limiting creative, productive, activity to the young and fit.
How many voices are silenced because they don't have the academic sinecures, the foundation grants, that will allow them to contimue to work into old age without having to perform before an audience like a trained seal?
What is it about the Geek?
That he is the eternal adolescent who thinks himself immortal?
What gives him the right to say that the punishing pace of the concert tour is the only legitimate source of income for an artist. What makes hin think that you can build a house, raise a family, on the sales of a coffee mug?
i started on Erlang on the mainframe. As was the nature of business at the time, I moved to Erlang on the mini (AS-400), and as PCs gained popularity, n-tier client/server Erlang. After developing ErlangScript to dynamically generate my web pages, I focused on fully implemented server-side Erlang.NET. Sadly, this has all been reduced to AEAX (Asynchronus Erlang and XML) as the language du jour. These junior high whippersnappers need to remember where they came from!
How to Design Programs is available online.
Great minds think alike; fools seldom differ.