unsafePerformIO

Koen Claessen koen@cs.chalmers.se
Tue, 24 Sep 2002 12:34:32 +0200 (MET DST)


Simon Peyton-Jones wrote:

 | The actions performed by unsafePerformIO are simply
 | done at some entirely unpredictable time, perhaps
 | interleaved with actions on the main execution path.

But it is a fact that many of us have at least some idea of
what happens "under the hood" when we use unsafePerformIO.
This is also described in your paper "Stretching the storage
manager: weak pointers and stable names in Haskell".

However, I for example have no idea what happens when
unsafely executing something that throws exceptions,
performs a forkIO, something that uses MVar's, etc.

It would be nice to see what happens in such a case, and at
least a document that informally describes what happens.
This includes issues such as loss of sharing because of
inlining, etc.

"unsafePerformIO" is the best thing since sliced bread for
someone who wants to add stuff to the compiler without
changing the compiler. The usefulness/portability at the
moment is limited since nobody "dares" to say what is going
on.

/Koen.