3 ms·
There's no accounting for taste, but as "jerf" posted in a sibling comment Erlang's not really functional[0]. All that's really happening is that the mutable st
by lomnakkus 12y ago
There's no accounting for taste, but as "jerf" posted in a sibling comment Erlang's not really functional[0]. All that's really happening is that the mutable state is "hiding" in the message passing portion of the application. Just as an example: It's pretty simple to implement a mutable reference cell as an actor which contains only pure functional code. I'm not sure where I first saw it demonstrated, I think it was one of Erik Meijer's talks/videos.
[0] I mean in the "no/minimal mutable state" sense.
EDIT: Removed potentially confusing aside.
EDIT#2: I guess I should elaborate: The idea is that you just have the MutableRef actor accept two messages: Set(X), Get(X). The basic idea was to just have the actor continually send itself Set(X) messages with the current value -- thus exploiting the messaging to keep mutable state.
- felixgallo 12y agoOf what use is this distinction, especially when zero languages fall within its definition? Honestly.
- lomnakkus 12y agoHm? Haskell is purely functional. (Alright, you can theoretically use unsafeCoerce and unsafePerformIO, but in practice it doesn't actually happen.)
- felixgallo 12y agoCan you please point me to any real-world Haskell program that is purely functional? I am interested in seeing what a program without I/O looks like.
- lomnakkus 12y agoAll of them. Remember that "IO a" is just a value. :) It's really the "interpreter" of the IO monadic values which causes all the side effects. I am aware that there are some issues with this interpretation, but if you want to get pragmatic it's really a question of X% pure/(100-X)% impure while keeping X as close to 100% as possible. Haskell can do that for X arbitrarily close to 100% (depending on how much abstraction/effort you're willing to go through).