[clean-list] Clean in the Real World

Marco Kesseler m.wittebrood@mailbox.kun.nl
Mon, 15 Dec 2003 10:25:07 +0100


Arjen Wrote:
>As I see it, catching exceptions is only non-deterministic between 
>compilations. There are more functions in the Clean distribution that 
>ought to use the !*World -> *World style, but since they are fixed for a 
>single run of a program (like getCommandLine, or things like 
>getProcessId) they don't. I don't like putting it in the IO 
>monad/!*W->*W, and it don't like disturbing ref.transp., but in this 
>case the second options suits me best.
>I am thinking about changing the 'unsafeX' functions in the StdException 
>library to 'X', and the 'X' functions to 'evenSaferX'.
>Just like any other expressions in Clean, you cannot assume much about 
>the evaluation order, so don't! Make sure that the code handles any 
>exception (from both a and b).

Well, if you just consider the "disaster" type of exception, hurting 
referential transparency _seems_ like a minor issue compared to the 
good old abort.

But for the "alternative return" type of exception this is clearly 
different, as this would just be an alternative to passing up error 
information yourself.

IF you take the non-deterministic approach, it is up to the 
programmer to map _any_ exception to the same result, so that 
referential transparency is restored at the catch.

But I'd rather not, if it is not needed.

regards,
Marco

P.S. I will write an answer to Fergus' mail too, but my attention is 
needed elsewhere now.