[erlang-questions] callcc or CPS in Erlang?
Wed Jul 27 12:05:57 CEST 2011
In a normal scenario, I would prefer serial code, admittedly.
However, the scenario that I want to implement is the following: I want to
retry the same piece of code several times, each time with a different
settings. The ways to do so are either making sure that each step in the
code is a function (i.e., CPS), or exploiting callcc.
On Wed, Jul 27, 2011 at 7:23 AM, Jon Watte <jwatte@REDACTED> wrote:
> 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.
> 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?
>> erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions