Wednesday, May 07, 2008

What Erlang is bad at

Recently I wanted to write a program which would take sections from a texmacs document and run them through the style command. And then process the results to get a particular set of statistics.

This includes some additional crunching on what style produces. As it was my language of the month as it where I thought I'll do it in Erlang, but after spending a train trip searching the documentation I found that making system calls in a subshell is not somthing that erlang can do at all easily. I certainly couldn't find a way which did not involve writing a c wrapper around in any case.

So it was back to python for this one and a usable script done in about an hour. Lessons learned: Erlang is not a good language for quick and dirty scripts. I'm not saying that it can't be but the standard library dosn't seem to support such a use case.

An aquantence who is also programmer told me once that he is also tempted to look at Erlang now and then, but he can never seem to find a project that he really wants to implement in it. More often then not he ends up in exactly this position "Man this would be so much simpler in Python" and so that is what he uses.

I think I have a new point to add to my list of what makes a good language:

"Can be used to solve small problems easily"

In this regard anything which requires copious poilerplate or is missing simple ways to interact with standard in and out looses instantly.

1 comment:

Anonymous said...

Issuing shell commands in Erlang is
*really* easy

os:cmd("...").

does the job.

Reading and writing stdio is trivial