[clean-list] Clean in the Real World
Fergus Henderson
fjh@cs.mu.oz.au
Thu, 18 Dec 2003 12:16:09 +1100
On 17-Dec-2003, Marco Kesseler <m.wittebrood@mailbox.kun.nl> wrote:
> Still: I REALLY do not like the Monadic solution. Sorry about that
> too, but that is something I cannot help. This is NOT a Monad thing
> in particular: I wouldn't like a "Unique World" solution either.
>
> Now there are a few things worth considering (in order of preference):
>
> * use something else than stack trimming. For _handling_ exceptions
> it is not that important that things go blazingly fast. However, I am
> afraid that things like (a) defining an order over exceptions and
> delivering the largest or (b) delivering the complete set of
> exceptions are no serious options either. At this moment, I cannot
> oversee what it would do to ordinary execution, but I am sure that
> you (Fergus) have looked into this.
I have considered it, but my first impression was that this approach
would be difficult to implement and would have major negative effects
on performance, so I haven't looked into it in great detail.
> In terms of the official semantics, this may be referential
> transparant. In terms of what the programmer sees and experiences, it
> is not. THAT is something that I do not like at all.
Well, the point is that all operations which might deliver different
results each time are specially marked, e.g. by putting them in the
IO Monad. Programmers know that operations in the IO Monad might
deliver different results each time.
This is the reality of programming in "pure" languages: they don't
actually prevent the use of all the impure constructs of imperative
languages, indeed they allow such constructs, complete with most of
the drawbacks for reasoning about programs that such constructs imply.
What these languages do is to just explicitly flag such constructs as
being impure, by putting them in the IO Monad (or equivalent), so that
programmers can safely apply equational reasoning to the parts of the
program which do not use them.
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.