[clean-list] Clean in the Real World

Jenda Krynicky Jenda@Krynicky.cz
Tue, 09 Dec 2003 16:18:27 +0100


From: fzuurbie@inter.nl.net
> In Clean the Sparkle proof tool has emerged: why do you need exception
> handling if you can prove at compile time that exceptions will never
> occur? 

Can you prove it for the whole OS? Or even the whole net?
Exceptions can ocure outside your program.

Just a very simple example ... how would you prove that your program 
is going to have enough memory?

> And of course, this will change (limit) the way we program or
> we will simply be unable to prove the absenc e of exceptions.
> 
> When I look around me where I work, software is littered with throwing
> and catching exceptions. I sometimes wonder whether the programs do
> anything else at all. The ease with which a programming problem is
> delegated to an ill understood run time mechani sm (exceptions
> handling that is) sometimes scares me. One should not be allowed to
> call such programs programs ('written beforehand') at all.

Exceptions allow you to handle errors at the place where the handling 
makes sense, which is not necessarily the same place the errors 
ocure. Exceptions usualy allow you to write much nicer code, instead 
of passing some status variables around and testing them all the time 
you just throw an exception and somewhere several levels up in the 
call stack you handle them.

Sure that in a functional language the exceptions would have to work 
(and would be used) in a very different way that in an imperative 
language, but I would not be so quick in calling them useless.

Jenda
===== Jenda@Krynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
	-- Terry Pratchett in Sourcery