[erlang-questions] callcc or CPS in Erlang?

Jon Watte jwatte@REDACTED
Wed Jul 27 06:23:41 CEST 2011


One of the biggest problems of CPS code in Twisted or Node or most other
frameworks using that mechanism, is that it ends up with single-threaded
servers, making poor use of multi-threaded hardware.
In Erlang, a process is comparable to the cost as a continuation with a
function lambda in other languages (give or take a little bit, depending on
specifics of implementation and use).
Write your code serially, in a process, and talk to it using messaging. It's
easier to write, debug, and understand that way. Because of data being
immutable, there is no risk of threading data hazards.

Sincerely,

jw

--
Americans might object: there is no way we would sacrifice our living
standards for the benefit of people in the rest of the world. Nevertheless,
whether we get there willingly or not, we shall soon have lower consumption
rates, because our present rates are unsustainable.



On Tue, Jul 26, 2011 at 12:39 AM, Guy Wiener <wiener.guy@REDACTED> wrote:

> Hello everyone,
> Is there some equivalent to callcc (as in Scheme or Ruby) in Erlang?
> Alt., is there some what to encourage Continuation-Passing Style
> programming in Erlang, other than just recommending that all consequent
> function calls will be in tail-call position?
>
> Thanks,
>   Guy
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110726/a63e0684/attachment.htm>


More information about the erlang-questions mailing list