[erlang-questions] suitability of erlang
Ulf Wiger
ulf@REDACTED
Thu Oct 11 16:44:05 CEST 2012
On 11 Oct 2012, at 16:17, Rustom Mody wrote:
> I have one more question that sits somewhere between parallelism and concurrency.
> In the 'normal' world (ie C++, Java, Python) there is a general recommendation that converting a threaded solution to an event-driven solution usually speeds up the program and removes hard-to-find bugs.
> And at the heart of an event-driven system is usually an FSM.
> Now I am particularly interested in the combined (regular-exp+FSM) approach that ragel provides:http://www.complang.org/ragel/
>
> In particular, here is the use of ragel to write an http server: http://www.zedshaw.com/essays/ragel_state_charts.html
>
> Now since ragel is more or less language agnostic -- it has backends for generating C, C++, Java, Ruby etc -- would an Erlang backend for ragel make sense?
As far as I can tell, Ragel is mainly for parser FSMs. As such, it seems
great, but I doubt whether it would add value to Erlang as a way to
specify concurrent (message-passing) state machines.
The thing it lacks that Erlang has, is selective message reception.
This allows Erlang to ignore a message in its inbox, and keep waiting
for the desired message. In coordination problems, this is a great
way to avoid complexity explosion.
I gave a talk about that a while ago:
http://www.infoq.com/presentations/Death-by-Accidental-Complexity
Basically, you _could_ generate Erlang FSM code from Ragel code,
I'm sure, but I think this would mainly be useful for porting existing
Ragel models over to Erlang. Ultimately, I think it would still be better
to do the 'porting' by hand, to give you a chance to think through the
problem in a more Erlang-ish style.
The FSMs that are easy to write in Ragel, also ought to be easy to
write in Erlang.
If I missed some clever device in Ragel that handles this, please
correct me.
BR,
Ulf W
Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc.
http://feuerlabs.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20121011/7f63360a/attachment.htm>
More information about the erlang-questions
mailing list