Skip to main content

Erlang: Toying with Erlang

I'm really interested in distributed computing and concurrency right now. Given that I've been playing with Haskell so much, I thought I'd give Erlang a try since it's all about distributed computing, concurrency, and scalability.

I must admit that it already seems easier for me to read than Haskell. I'm not sure why. As I mentioned before, I do like Erlang-style concurrency, since strangely enough, that's how I had always thought things should work.

I'm fascinated by Mnesia, Erlang's distributed database. Unfortunately, according to this:
Mnesia is not perfect, of course, and its biggest downside at the moment is that its disc storage engine isn't suited for storing large volumes of data (Mnesia was designed for soft real-time applications where the data is stored mostly in RAM), but I hope this will be resolved in the not-too-distant future.
This is a major downer for me because I'm currently interested in terabyte-sized data sets. Nor is there a suitable MySQL driver.

Yaws is the Web application framework for Erlang. I can't say whether it's good or bad, but as a matter of taste, ever since I used Apache's Element Construction Set back in the day, I've had a particular dislike for generating HTML using programming language syntax as is done in Yaws:
%% the little status field in the upper left corner
head_status(User) ->
T =
{table, [],
{tr, [],
[{td, [{width, "30%"}],
{table, [ {border, "1"}, {bgcolor, beige},{bordercolor, black}],
[{tr, [], {td, [], pb("User: ~s", [User])}}
{td, [{align, right}], {img, [{src, "junk.jpg"}
Yuck :(

Nonetheless, Erlang has already taught me new ways of thinking about distributed computing. I guess I'm wondering if there's anything I can't do the Erlang way in Python. Afterall, consider Candigram, which is an implementation of Erlang concurrency primitives in Python; although Candigram itself doesn't provide microthreads like Erlang. That reminds me, I'm still looking for an answer to my post Limitations of Coroutines via Enhanced Generators.

And if you're wondering--no, I don't know what the hell I'm talking about! I've only been looking at this stuff for like two days! I guess I should just shut up and go back to reading Erlang for C, C++ and Java Programmers. Hmm, I wonder where the tutorial for Python programmers is ;)


jjinux said…

Ugh, so you mean I won't have regular expressions that support UTF-8?
jjinux said…
More about Mnesia's limitations:

The ODBC driver for Erlang:
Andrew Dalke said…
Try out stackless python.
jjinux said…
I have. I was really looking for the benefits of stackless Python without the heavy-handed approach that it uses to implementing it ;)
Richard said…
I quite liked this simple equivalent to Stackless's tasklets written in lisp or scheme (same difference to me). As you can see from the comment I added, the lisp test case maps pretty much one to one to the Stackless one.
Andrew Dalke said…
I was really looking for the benefits of stackless Python without the heavy-handed approach that it uses to implementing it ;)

Though it's not as heavy-handed as switching to a different language entirely. Think of it as a different language which just happens to support existing Python code and extensions.
Steve Jenson said…
You can fragment mnesia tables to store terabytes of data. Check out
Section 5.3
jjinux said…
Thanks for all the great comments guys!
Bill Mill said…
What about this or this as your erlang mysql driver?
Bill Mill said…
whoops, those two links are to the same driver. Anyway, have you tried it? It looks pretty nice to someone who hasn't tried it.
Anonymous said…
Candygram is spelled w/ a "y", not an "i"
Qrilka said…
Have you tried Erlyweb?
BTW Yaws is actually a Web server not a framework (wich is Erlyweb on top of Yaws)
Anonymous said…
check out, this guy yariv is building all kinds of erlang webby stuff....incl a mysql driver, web framework, template language, object-relational mapping, and a macro system.
jjinux said…
> check out

Yeah, I was checking it out before. He seemed at the same time brilliant and "young" (meaning, he was doing stuff that I had done before but turned out not to like). I'm sure he's smarter than I am ;)
jjinux said…
> What about this or this as your erlang mysql driver?

Nope, I haven't tried it. I think it came out after I looked last.

> Candygram

My apologies.

> Have you tried Erlyweb?

No, it's new to me.

Wow! So many Erlang comments!

Popular posts from this blog

Ubuntu 20.04 on a 2015 15" MacBook Pro

I decided to give Ubuntu 20.04 a try on my 2015 15" MacBook Pro. I didn't actually install it; I just live booted from a USB thumb drive which was enough to try out everything I wanted. In summary, it's not perfect, and issues with my camera would prevent me from switching, but given the right hardware, I think it's a really viable option. The first thing I wanted to try was what would happen if I plugged in a non-HiDPI screen given that my laptop has a HiDPI screen. Without sub-pixel scaling, whatever scale rate I picked for one screen would apply to the other. However, once I turned on sub-pixel scaling, I was able to pick different scale rates for the internal and external displays. That looked ok. I tried plugging in and unplugging multiple times, and it didn't crash. I doubt it'd work with my Thunderbolt display at work, but it worked fine for my HDMI displays at home. I even plugged it into my TV, and it stuck to the 100% scaling I picked for the othe

ERNOS: Erlang Networked Operating System

I've been reading Dreaming in Code lately, and I really like it. If you're not a dreamer, you may safely skip the rest of this post ;) In Chapter 10, "Engineers and Artists", Alan Kay, John Backus, and Jaron Lanier really got me thinking. I've also been thinking a lot about Minix 3 , Erlang , and the original Lisp machine . The ideas are beginning to synthesize into something cohesive--more than just the sum of their parts. Now, I'm sure that many of these ideas have already been envisioned within , LLVM , Microsoft's Singularity project, or in some other place that I haven't managed to discover or fully read, but I'm going to blog them anyway. Rather than wax philosophical, let me just dump out some ideas: Start with Minix 3. It's a new microkernel, and it's meant for real use, unlike the original Minix. "This new OS is extremely small, with the part that runs in kernel mode under 4000 lines of executable code.&quo

Haskell or Erlang?

I've coded in both Erlang and Haskell. Erlang is practical, efficient, and useful. It's got a wonderful niche in the distributed world, and it has some real success stories such as CouchDB and Haskell is elegant and beautiful. It's been successful in various programming language competitions. I have some experience in both, but I'm thinking it's time to really commit to learning one of them on a professional level. They both have good books out now, and it's probably time I read one of those books cover to cover. My question is which? Back in 2000, Perl had established a real niche for systems administration, CGI, and text processing. The syntax wasn't exactly beautiful (unless you're into that sort of thing), but it was popular and mature. Python hadn't really become popular, nor did it really have a strong niche (at least as far as I could see). I went with Python because of its elegance, but since then, I've coded both p