Erlangst (n) : The fear that (subject) is not smart enough to program in, or even comprehend, the Erlang programming language.
related: Haskellitis, Lisp Cringe
Tags: programming
Erlangst (n) : The fear that (subject) is not smart enough to program in, or even comprehend, the Erlang programming language.
related: Haskellitis, Lisp Cringe
Tags: programming
March 13th, 2009 at 12:42 am
Erlang is pretty easy to learn! You can do it! It’s a very small and simple language. One of the things that makes it easy is the fact that for anything you want to do, there is probably just one good way to do it.
March 13th, 2009 at 12:58 am
And that one good way of doing thing is probably captured in a OTP behaviour
March 13th, 2009 at 1:28 am
Mike: thanks for your thoughtful comment. I’m ashamed to admit that I only wrote this post to have something ridiculous-sounding to submit to HN in aid of their “scare off the n00bs” campaign, but it does have a grain of truth!
I guess when it comes to functional languages I just haven’t had a clear need to learn one yet; programming doesn’t come very naturally to me so I can’t really learn them for fun. I’m also kind of waiting for a “winner” – there’s a number of options, none of them really appeal to me syntactically, and they seem clunky and dated. I mean just look at this code from something I read recently:
http://www.clickcaster.com/items/unicode-and-erlang–handling-utf-8
Jesus, I don’t even want to look at that, let alone learn it. I guess I’m waiting for the Ruby of functional programming languages…
March 13th, 2009 at 11:05 am
The ugliest part of the code you linked to are the comments and lack of newlines. Still, I think erlang binaries+pattern matching is unique in the way it lets you parse a bitstream and bind its contents to variables, all in one single line.
You also managed to discover the biggest flaw in erlang: string handling. Learn to love latin1 or enjoy the pain of conversion functions.
March 13th, 2009 at 2:11 pm
Sho: don’t get distracted by the tubthumping of the functional nuts; the reason you don’t have a reason to track down a functional language is that there isn’t honestly that much of one. The assertions that functional programming lead to denser or terser code are nothing more than expositions of people who have never seen K or Mozart-Oz.
What’s important about Erlang are five things:
1) Erlang has the pi calculus, which in handwaving terms is to processes what the lambda calculus is to functions: a model by which the target may be passed around and acted upon as data, and which through well chosen restrictions eliminates unsafeties which allow you to follow through on strategies which otherwise would be untenable without a very deep sophistication;
2) Erlang’s primary design goal is reliability, and it has taken an extremist stance on the matter, which leads to a model wherein it is so straightforward to write software which is so fault tolerant that it can handle the loss of entire machines without blinking that many programs have that capacity without conscious design on the part of their authors;
3) As a descendant of prolog, erlang’s combination of pattern matching, list comprehensions and guarded clause selection, while initially difficult to read, quickly leads to amazingly clear, amazingly dense code. A fault tolerant job clustering map reduce, for example, is implemented in my personal library in twelve lines of code (see http://scutil.com/docs/ ).
4) Erlang is designed for massive parallelism, including its own internal timeslicer – modern commodity boxes which choke in the low tens of thousands of processes on Windows and Linux on Erlang can scale happily into the tens of millions of processes without problems or even particularly savvy design; Yaws’ performance spankfest on Apache, despite being a tiny and not particularly well written project, speaks volumes.
5) Erlang is an adequate glue language, meaning that you can relatively straightforwardly replace legacy systems one piece at a time.
Don’t worry – once you get it, you’re going to love it.
March 13th, 2009 at 11:16 pm
Sho, it’s silly to think that something like a codec that’s converting binary values back and forth would look pretty. However, if you checked out the bit syntax (most of the scary stuff in that post) you’d see how much better it is than the alternative. In other languages, you’d need to do bitwise operations. With the bit syntax, you can deconstruct a TCP packet into variables in one statement! http://erlang.org/documentation/doc-5.4.12/doc/programming_examples/bit_syntax.html
Programming doesn’t come naturally for me either, but I find that branching out and learning other languages is one of the best cures. I started in ASP 3.0.
March 18th, 2009 at 9:47 am
Ironically, the latest beta of Erlang now has UTF-8 support built right in, so the hideous code I posted above would no longer even be necessary.
I have to admit that was a serious impediment to me – I deal with unicode *all the time* and absolutely need good language support. Even though you could hack support in, like in the code above, the lack of native support gave me a seriously bad impression – back to the days of frigging around with god damn text encoding.
Well, they’ve included it now and so I have to eat my words. I’ll give it another try : )