Classic SmugErlangWeenie claims:
So, the task is to populate this page with clever and piercing commentary on the outrageous and inflammatory claims typical of the SmugErlangWeenie. But alas! Though it's easy to find Erlang programmers praising their beloved language, they too seldom use it to smugly disparage other respectable languages.
Well, perhaps we can make a start at correcting this unfortunate oversight - how about a few provocative claims about writing concurrent programs. But whom should we provoke? It has to include those most likely to provide witty and incisive reactions, and that must surely include the SmugLispWeenies (after all, everybody else is already busy having a go at them). So let's build our inflammatory claims on top of PaulGraham's famous article, BeatingTheAverages (cf. BlubParadox):
(The Lisp programmer may retort that Erlang has nothing to match Lisp's macros. And he'd be absolutely right. That just goes to show how silly the SmugLispWeenie's one-dimensional model of language power is!)
So what is "proper" concurrency? Having proper concurrency means that you can easily write a program that does a great many things at once, without using any "tricks", and the program is easy to understand. To have this property in a programming language requires the other language features to be chosen carefully. You mustn't have to fight the other parts the language to write concurrent programs. As they say, the forces must be balanced, and the language must be consistent within itself.
Java does not have proper concurrency, because concurrency doesn't fit in with the rest of its features. Adding concurrency adds complexity. Are my objects thread-safe? and which ones have to be?. These questions are difficult because you are fighting the paradigm. Most state and behaviour is encapsulated within objects, but concurrency is not. Each method call or state change in an object is a potential interaction between threads. To understand the program, you must understand all of these interactions. The tension between hiding behaviour within objects and exposing it to understand the concurrent interactions is not resolved by the language. In fact, only some parts of the language even support the concurrency they do have; see http://java.sun.com/products/jfc/tsc/articles/threads/update.html.
Thought experiment: can you imagine a horrible concurrency bug involving 'java.lang.Vector'?
CommonLisp does not have proper concurrency either, and you can't just add it with a few macros, or even a few special forms. Lisp has a lot of features that work against concurrency: data structures are frequently modified, functions are redefined, assignments are made to shared variables, and so on. The idea of making it easy to write concurrent programs isn't on the radars of Lisp programmers yet. When they implement concurrency, it's the low-level kind like C and Java, suitable only for writing hairy and complicated programs. These features introduce whole new classes of bug to large bodies of code that were previously correct. Like ThreeStarProgrammers of Blub, they ignore the "weird" alternatives, and just go with the macho low-level ways they know.
'Termite scheme implements proper concurency'
Thought experiment: what would be harder, adding Erlang's concurrency to Common Lisp, or Lisp's syntax and macros to Erlang? How would each turn out?
The latter has been done: see Robert Virding's LispFlavouredErlang?, a Lisp-2 at http://github.com/rvirding/lfe/
Well, as pointed out below - CommunicatingSequentialProcesses can be modelled in almost any programming language which supports threads. All you gotta do is refrain from sharing any mutable objects; and communicate solely via passing immutable ValueObjects around. Which can certainly be done in LispLanguage--SmugLispWeenie (You still lose bigtime for having to make all of your libraries "thread-safe.")
Yes, Common Lisp is powerful enough that you can do proper concurrency, in principle, but it seems to me any time you have to tell yourself "all you have to do is not do X and not include any code that does X, and only ever do Y," I'm not sure that it ever works out. You end up having to build the whole library around not-doing-X, at which point you might as well have your own language since you can't even import anyone's existing code without auditing it for X. Indeed Lisp with a library built around concurrency is the basic point of ClojureLanguage, though Clojure is focused on within-JVM concurrency and doesn't match Erlang's story for distributed processes.
Insert your smug assessment of any other language here.
Rule of thumb: if you ever hear yourself say, "We need to audit that code for thread-safety", then you are programming in the wrong language.
Erlang does have proper concurrency. An Erlang program is structured as a set of small CommunicatingSequentialProcesses. The needs of such processses are reflected in the other features of the language: data structures are immutable, so you cannot accidentally "communicate" by modifying them, even by accident (bug); interaction is by explicit message passing, so simple interactions are easy and complex interactions are possible (and easily recognised); most of the code does not require interaction and is purely functional, which completely separates it from concurrency concerns; the principle of supervisor processes handling recovery/restart/logging for other processes leads to very robust programs.
Some of these features may seem small, and others may seem inconvenient, but in combination they are marvellous. Erlang is an exceptional language because adding more of the real world's concurrency to a program doesn't add complexity and confusion, it makes the program simpler and more robust.
When are the rest of you going to get it?
Contributors: LukeGorrie (also a SmugLispWeenie)
Please flame below this line:
This is all quite silly. At no point does Erlang claim to be the end-all of languages; in fact, right in the list of advantages of the language in the beginning of the manual is that it's easy to interface to other languages for problems that are better solved in other languages, and at many points the language manual displays specific problems whose solutions in Erlang are cumbersome or inefficient. These language wars only come up around those who haven't actually read the manual, which goes to say a lot about the kinds of people who engage in this kind of vacuous diatribe. Erlang aims to do one thing and to do it well: soft realtime massive parallelism with an emphasis on fault tolerance. The weenies making the wars you're talking about are mostly coming from inflammatory pages like these. You, sir, are creating the people about whom you kvetch.
By the by: your smugness is off the charts. To point it out in others is an exercise in displaying ignorance of your own demeanor.
What's good about erlang is it is impossible to do it another way. Java/C++/etc can be structured as CSPs, but any programmer at any time can can make cross-thread calls.
I think the area of smugness that you are looking for is that erlang weenies realize that OO programmers are locked in a sad and confining mindset. And those few OO'ers who are deprogrammed and/or liberated by erlang feel a euphoria that often reduces/eliminates any desire to go back and taunt the less fortunate who remain shackled to lesser languages/environments.
That being said, how is the AspectOrientedProgramming thing going? - I love AOP because after you peel away all the pompous handwaving it is really just a way to legalize breaking encapsulation and since the BS is so deep people don't notice that it is really just adding global procedural subroutines to OO land - rather than a saving grace, I'd call it a deep crack in the dam... Maybe they should call it ProcedJ instead of AspectJ
As long as I moved into the realm of "things that cannot be said", I'd say that from where I stand OO seems to be like the Ptolemaic theory of the solar system, a complex system with lots of epicycles and when problems arise, a few more epicycles get chucked onto the pile. I have got to think that the successor to OO will have a more simple, elegant flair (Erlang?) not unlike how Kepler elegantly simplified astronomy. I think there are probably other of the same opinion, but they are shouted down by those who are making money from OO. How long do OO people think that OO will remain the best advertised, most profitable programming paradigm (I hesitate to say most popular since people tend not to choose their programming methodology, they just take what is on the bookshelf at the time)? I think AOP is a sign of the beginning of the end.
-- A Smug Erlang and otherwise non-OO Weenie who mistakenly ended up in OOz [I blame google!] :)
Firstly, congratulations on your smugness. You have penned a rant that would make PaulGraham proud; if you keep working on your technique you might find yourself in the august company of ErikNaggum. Well done, Sir.
Of course, a few facts may require correction:
"To which I must ask: Complicated in what way?"
Sorry, you cannot have an answer. I invoke Date’s Incoherence Principle — It’s not possible to treat coherently that which is incoherent. First, define coherently what is OO. After that we can discuss, coherently, in what way it is too complicated. Until then the right answer is "'I think OO is too complicated'". The burden is on OO, not the people who recognize that it is unformalized.
OO is polymorphism, and the calling of methods in objects. That's the minimum set of features every languages that calls itself OO has. There are other features that many OO langauges have but those two are the main ones. But from your rant I think what you're really trying to say is not that OO is too complicated but that Java is too complicated, and on that I would agree.
Erlang is a pretty language, especially the concurrency. Hopefully it will be the next big language.
Erlang does have macros. How are they different from CommonLisp or SchemeLanguage macros? they are like CeeLanguage macros
It's possible to hook into the compiler to perform syntactic transformations (I believe the bit-field syntax was implemented this way) but, by all accounts, rather hairy.
Smug they may be, but they have something to be smug about. I wouldn't be so sure my language is good if I were a VB programmer, but with Erlang ...