[erlang-questions] The Beauty of Erlang Syntax
Wed Feb 25 13:39:22 CET 2009
On Wed, Feb 25, 2009 at 11:22 AM, Michael T. Richter
> On Wed, 2009-02-25 at 10:56 +0100, Joe Armstrong wrote:
>> Functional-capable languages have been around longer than object-oriented
>> ones. (Lisp predates Simula, no?) Hell, functional programming was known
>> at about the same time that the whole notion of structured programming
>> reared its head if memory serves (and it may not). Yet imperative
>> programming, despite its counter-intuitiveness (X=X+1? are you smoking
>> those funny cigarettes again?) won the day.
> It gained a temporary victory
> You're begging the question, Joe. WHY did it gain this temporary victory?
Because at the time FPLs were not ready for wide-scale industrial deployment.
(Ready here means has achieved critical mass in industrial projects, has earned
a few hundred million dollars, means "bet your business stuff")
C++ came of age in October 1985 (first book and commercial release)
Erlang started in 86 and was not ready for prime-time until a decade later
Haskell started in 1987 ...
C++ has a 10 year start ...
When C++ came is was heavily marketed as the successor to C ("an
improved C") since C was very
popular it took off like a rocket.
C++ spread as if in a vacuum - there were no competing FPLs at the
time (Lisp possibly - but
this needed an expensive lisp machine).
Java came later and was perceived as OO done properly (in the sence
that C++ was not really OO)
The step from C to C++ was perceived as easy, the step from C++ to
java was perceived as easy.
The marketing guys and hipe machines were in full swing.
I remember being told by a salesman with a PhD in CS that C++ class
libraries would solve
all problems forever - write once - inheret the code in the future -
the end of SW development.
This was the best form of snake oil and management bought in to it by
the barrel load.
At the time, the big class libraries did not exist, big projects had
not yet failed, and
FPLs were not ready for prime time.
CS departments taught programming (C, C++, Ada) and Math departments
taught ML or Prolog (if you're lucky)
By 98 when Erlang was ready for prime time - java etc have captured
all market share
At this stage being better isn't an option - we have to be > 10 times better AND
the existing technology has to have problems.
Well this condition has been satisfied in many areas, we have achieved
critical mass and are
Eventually we will have to fight out market share between
but today we stand to loose by this.
We are gaining market share, we are market leading in the niche markets that we
have chosen to attack (for example messaging, XMPP etc - ejabberd)
As time goes on more niche areas get added to the areas where we have
> You said that people have no problems when first encountering functional
> programming. (This runs counter to my experience, but I'll assume we just
> ran in different circles and move on from here.) If functional programming
> makes more sense to beginners, if imperative programming is so
> counter-intuitive, so difficult and so prone to failure (and I will agree
> 100% with that last point), how did it become the dominant paradigm for
> pretty much all of computing's existence? Again I have to say, there must
> be something that gave it a (perceived) edge over functional programming.
History - it was ready for prime time *before* FPLs - FPLs were a nice
theory in the 1930's and onwards
but not something to bet your $$$ on, That was changed.
> THAT is what fans of functional programming (and I include myself in this
> number, I hasten to add!) have to address. Not making excuses like "they're
> too stupid to understand" or "Microsoft/Sun's evil cabal forced it".
>> New paradigms take me years to suss. (I'm still not 100%
>> like 80%--with the functional, for example. I've been trying off and on,
>> more off than on, for about ten years now.)
> Yes - this OOP stuff is *really* difficult - I just don't grok it
> Took me about five years of concerted effort before I could comfortably call
> myself an OO developer.
>> As I said, the shift to OOP involved syntax and conceptual elements that
>> broke existing thought patterns. Yet OOP caught on, functional did not.
> Not *then*
> But this is my point exactly. Why didn't functional programming kick ass
> then? What was it about functional programming that relegated it (hopefully
> temporarily) to the dusty halls of academia?
Because it wasn't ready - in 1987 when people were *shipping* products in C++
FP academics were arguing over the advantages of lazy/eager evaluation
and couldn't agree
> (One of the single dumbest
>> statements I've ever heard a really smart guy say was something along the
>> line of "if we'd called monads 'Warm Fuzzy Things' instead people wouldn't
>> be so afraid of them". The scary part of monads isn't the name. It's the
>> fact that nobody has coherently and concretely explained what they are!)
A lot of people have explained - a lot - the fact the question comes
up time and time again
is that the idea is difficult to grock. But perl is difficult to grok,
C++ templates are difficult to grock.
As my friend Robert says "Don't think just do it" - these are patterns
you need to learn -
deep understanding comes later.
<< When I majored in physics I did not understand Fourier transforms
on first contact - nobody
did - how can you represent since waves by superimposing square waves?
I didn't grock it. I understood
the math, but not the idea - two years later it seemed like I'd always
understood it. new ideas
take time, and you may not understand them the first time round - some
things are difficult
> Yes - agree - we need *lots of good books* and we need to loose the
> "academic" stamp.
> Your book on Erlang was a great beginning. The new book on Haskell is a
> fine addition to the arsenal. About fifty more of these and we're on our
So get writing ! Now is the time for the non-experts to wade in with
the applications - write a book
on ejabberd, mnesia, yaws, ... *pleeeeeeeeeease*
> Trouble is most of the really-good erlang/Haskell programmers are too
> busy working
> in companies that are totally smashing all competition to be bothered to
> what they're doing.
> I've heard this asserted many times. I have seen literally zero evidence of
> it. Where is this list of companies going out and kicking ass on the
> competition with their 133t coding skillz and Haskell/Erlang/*ML/whatever?
> This isn't a flippant question. It would be really nice to show large,
> successful companies using Haskell and/or Erlang in real-world situations
> that aren't niches.
But the niches are where FPLs are first adopted - non niche only comes
with wide scale adoption.
http://kreditor.se/index.php is a nice example of an erlang
company, other folks can contribute mroe info here...
(Erlang is pretty much pegged as a niche telecom
> language, for example, while Haskell is pegged as a language only eggheads
> like.) Business cases would be far simpler to make if this could be shown.
> I get Erlang to write the C for me :-)
> This is an intriguing idea. Care to blog on it?
Not really - just make a HOF that returns C, then make HOFS that combine HOFS
and then combined HOFS can make C - pretty easy - I've used this to
IMHO Erlang should be implemented this way - writing C by hand is
tricky - the BEAM
for example was just this - each beam instruction could be either
interpreted (as in the current
Erlang VM) or cross compiled to C (since it was a C macro)
> Michael T. Richter <ttmrichter@REDACTED> (GoogleTalk: ttmrichter@REDACTED)
> I can see computers everywhere - except in the productivity statistics!
> (Robert Solow)
More information about the erlang-questions