Dave Thomas ha escrito:
One of those areas is concurrent programming. As the world moves to
multi-core processors, and as we start to write applications
distributed across intra- and internets, we need to find better ways
to exploit all this extra power. If you've ever tried to write
concurrent programs in Java, or even Ruby, you know the challenges.
So, I have to ask. There's already some good and fast multithreading
languages out there (Lua, for example), and concurrency in the form of
light threads is pretty much available in most popular languages
(python, ruby, lua, java, etc). TCL and Lua's interpreter state,
allows easily doing somewhat akin to Erlang's processes, if I
understand correctly. So, what is it that makes Erlang special in
this aspect?
My current (perhaps wrong) impression is this: Erlang's processes are
more akin to TCL's or Lua's interpreter state, so each thread does not
share any info with another by default. To implement sharing data
around, Erlang uses a built-in queue mechanism among its processes
which is very simple and elegant and similar to ruby's case statement
(which is good and smart -- no need to create semaphores or yields
everywhere like you need with other languages), but I'm not quite sure
if that could be end up being somewhat limiting also if you need to
share a lot of data across. I'm also not clear how easy (or
possible?) it is to interface Erlang with C or C++, for example.
I like it for that reason. I also like it because it's different--
very different. It makes me think about problems in a totally
different way.
That it is. It is 100% functional programming pretty much, albeit its
syntax is much more accessible than something like Ocalm or Haskell
(at least to me).
P.S. For what it is worth, in the industry I work on, we have already
been briefly exposed to Erlang, thanks to the 3d package wings3d. The
software, when it showed up, was pretty revolutionary (other than
Mirai --written partly in lisp-- nobody had tried to do a 3d tool with
a scripting language and succeeded), but it also showed (to me) some
flaws with Erlang (slow execution, hard for people to pick it up,
problematic to implement and replace complex data structures and some
problems with backwards compatibility -- my ubuntu box currently
segfaults with wings3d). So, I'll admit I already have some bias
against the language, but maybe I have missed some of its beauty and
wings3d might not be the best example of Erlang code out there.