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 =
{ehtml,
{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 ;)

Comments

http://erlang.org/faq/x479.html#AEN513

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

http://erlang.org/faq/x1409.html

The ODBC driver for Erlang:

http://www.erlang.se/doc/doc-5.4/lib/
odbc-2.0.2/doc/html/part.html
Andrew Dalke said…
Try out stackless python.
I have. I was really looking for the benefits of stackless Python without the heavy-handed approach that it uses to implementing it ;)
Richard Tew 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
Thanks for all the great comments guys!
Bill said…
What about this or this as your erlang mysql driver?
Bill 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"
Kirill 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 yarivsblog.com, 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.
> check out yarivsblog.com

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 ;)
> 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!