
On 2009 Apr 10, at 0:14, Luke Palmer wrote:
On Thu, Apr 9, 2009 at 8:47 PM, Brandon S. Allbery KF8NH
wrote: Stuff like forkIO and newIORef can also be understood that way, it's just a bit more complex to follow them around.
Have you tried forkIO? I used to think that "world passing" was an acceptable, if ugly, semantics for IO. However, after doing some formal modeling, I realized that forkIO breaks the model altogether. What happens to the end state of the forked thread?
What happens to it when main returns? When you fork a subprocess, and when it exits? Same answer, although it might be better modeled as passing a reference to the RealWorld around to model independent threads all doing I/O (at least, I don't *think* forkIO is just a funny-looking unsafeInterleaveIO). In any case, threads and process forks do complicate things but could be emulated if I wanted to go to the effort of implementing green threads in single-threaded Haskell code; the RealWorld is the least of the problems introduced, it's best thought of as cloning part (threads) or all (processes) of the program's own state, which is *also* conceptually contained in the RealWorld. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH