From: Csaba Henk Date: 2006-07-22T00:35:08+09:00 Subject: Re: Beyond threads? Better concurrency methods? On 2006-07-21, tsuraan@tsuraan.net wrote: >> Well, in Erlang it's a principle that processes may communicate _only_ >> via the messaging interface. It's achieved by the (almost) pure >> functional semantics. Data is never modified in-place, always copied. A >> function (in particular one ran in a process) can see only the values >> which were passed to it as arguments (by value). > > How (almost) pure functional? I haven't used Erlang much, but it seems > to be totally pure-functional from what I can tell. They do use > looping threads to keep state, so side-effects are possible that way, > but is there a way to override defined variables? * As I heard, you are not prohibited to play dirty tricks with the few globally accessible data structure like the process table (although doing that is not considered to be good style). * IIRC message passing is considered a side effect generating call. I could imagine a concurrency semantics where it's not a side effect; I don't see how Erlang's semantics relates to that. * The big beast: I/O. A purely functional language must somehow encode I/O as environment (world state) passing, like Haskell does it with monads and Clean with unique types. Erlang doesn't want to sink into such abstractions, it just does I/O as usual. >> I wonder how would you enforce this strong separation in ruby... maybe >> _why-s shiny Sandbox could be made use of? > > For the places where Erlang is supposed to be used, I suppose that the > extreme separation they use is a really good idea, but I'd love to just > have the syntax available in Ruby. I tend to design a lot of my > programs as processes sending each other messages right now (mind > polluted by erlang, I guess), and just being able to have some nice > syntax for that in ruby would make me quite happy. I don't see into your mind, but maybe what's there is closer to the idea of coroutines than to CSP style models. Regards, Csaba