tag:blogger.com,1999:blog-178174920347765771.post8333808293262753604..comments2023-10-30T09:20:21.742-07:00Comments on One Div Zero: But, But...You Didn't Mutate Any VariablesJames Iryhttp://www.blogger.com/profile/02835376424060382389noreply@blogger.comBlogger10125tag:blogger.com,1999:blog-178174920347765771.post-18060922079706895332009-05-15T02:28:00.000-07:002009-05-15T02:28:00.000-07:00Sorry for being so late, but I missed this.
I thi...Sorry for being so late, but I missed this.<br /><br />I think all the discussion about how low-level state is handled clouds the issue and is basically irrelevant. In the OO example state is kept in a variable which is explicitly mutated, while in Erlang and Haskell state is kept in the arguments to the functions called. So in erlang you basically get:<br /><br />loop(State) -><br /> Robert Virdinghttps://www.blogger.com/profile/16187415127098159771noreply@blogger.comtag:blogger.com,1999:blog-178174920347765771.post-58597922812328517582009-04-16T16:52:00.000-07:002009-04-16T16:52:00.000-07:00yegge?yegge?Raoul Dukehttps://www.blogger.com/profile/07354740962526930549noreply@blogger.comtag:blogger.com,1999:blog-178174920347765771.post-71020444804312211552009-04-16T15:30:00.000-07:002009-04-16T15:30:00.000-07:00Interesting article.
Instruction pointer and call...Interesting article.<br /><br />Instruction pointer and call stack can definitely capture state. And, the state will have to be represented using variables or registers at some lower level, unless you are using functional hardware. :-)<br /><br />This reminds me of RoboZZle, a robot-programming online game (http://robozzle.com/) that I work on. You program the robot using only functions, movementAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-178174920347765771.post-72618326237768367412009-04-16T01:01:00.000-07:002009-04-16T01:01:00.000-07:00Any language with side effects has state, because ...Any language with side effects has state, because you can check whether the side effects have happened or not. If you don't have side effects, you might as well not bother, because your program doesn't do anything.<br /><br />As you point out, Erlang has state because the response to a message is not necessarily always the same. The internal state of a process is encoded in the IP. <br /><br />Anthony Williamshttp://www.justsoftwaresolutions.co.uk/blog/noreply@blogger.comtag:blogger.com,1999:blog-178174920347765771.post-79819703988577041812009-04-15T23:47:00.000-07:002009-04-15T23:47:00.000-07:00Indeed, I've done the same thing that Chris Rathm...Indeed, I've done the same thing that Chris Rathman has, modulo the exercises from Chapter 3.<br /><br />This also illustrates that it is indeed possible to create race conditions, even in Erlang. With a bit more work, it's even possible to demonstrate race conditions without explicitly emulating state variables.<br /><br />However, Erlang's race conditions don't seem to be as pernicious, Unknownhttps://www.blogger.com/profile/06462854866941248768noreply@blogger.comtag:blogger.com,1999:blog-178174920347765771.post-28674097685173737772009-04-15T19:06:00.000-07:002009-04-15T19:06:00.000-07:00Not sure if it helps make the point, but I used th...Not sure if it helps make the point, but I used threads to mimic mutable state variables in Erlang to translate the examples of <A HREF="http://www.codepoetics.com/wiki/index.php?title=Topics:SICP_in_other_languages" REL="nofollow">SICP Chapter #3</A>.Chris Rathmanhttps://www.blogger.com/profile/18187318795557832418noreply@blogger.comtag:blogger.com,1999:blog-178174920347765771.post-87057879818865190572009-04-15T18:03:00.000-07:002009-04-15T18:03:00.000-07:00The generated assembly from the haskell benefits f...The generated assembly from the haskell benefits from adding '-fvia-c' and involving GCC in the process, but it still has the unnecessary register->memory->register stuff. No such issue with OCaml.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-178174920347765771.post-49637709016664407542009-04-15T17:08:00.000-07:002009-04-15T17:08:00.000-07:00Have you looked at Reia? I'm trying to make a Rub...Have you looked at Reia? I'm trying to make a Ruby-like faux mutable state language which runs on the Erlang virtual machine:<br /><br />http://wiki.reia-lang.orgTonyhttps://www.blogger.com/profile/05698660503129206682noreply@blogger.comtag:blogger.com,1999:blog-178174920347765771.post-63188409226026267472009-04-15T07:06:00.000-07:002009-04-15T07:06:00.000-07:00Thanks per, I might give that a try sometime.Thanks per, I might give that a try sometime.James Iryhttps://www.blogger.com/profile/02835376424060382389noreply@blogger.comtag:blogger.com,1999:blog-178174920347765771.post-3274817942702573042009-04-15T06:39:00.000-07:002009-04-15T06:39:00.000-07:00If you want to see the native code for an erlang f...If you want to see the native code for an erlang function you can write hipe:c({M,F,A}, [pp_native]) in a hipe enabled system. This will also native compile the function. <br />M is the module name.<br />F is the function name.<br />A is the arity (number of arguments).Unknownhttps://www.blogger.com/profile/02964702676374494771noreply@blogger.com