From mboxrd@z Thu Jan 1 00:00:00 1970 Subject: Re: [9fans] same functions everywhere From: John Murdie To: 9fans@cse.psu.edu Cc: john@cs.york.ac.uk In-Reply-To: <3EBBF24B.3020508@ameritech.net> References: <622b8580ff4fa7e12cb655bf19694fe8@vitanuova.com> <1052497182.736.14.camel@pc118> <3EBBF24B.3020508@ameritech.net> Content-Type: text/plain Message-Id: <1052587025.734.55.camel@pc118> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Date: Sat, 10 May 2003 18:17:05 +0100 Topicbox-Message-UUID: a795d08c-eacb-11e9-9e20-41e7f4b1d025 On Fri, 2003-05-09 at 19:24, northern snowfall wrote: > > > > > >And then what should one do? Suppose that a "genuinely surprising > >condition" occurs when a launch vehicle is a few tens of seconds off the > >ground; just what should the program do? > > > Hopefully, the programmer would have enough sense to > see this coming? The point of smart design is to facilitate > the unexpected, I don't think that means exceptions are > the answer. Certainly, this argument is slightly dramatic, > wouldn't you agree, John? That's precisely my point (and, yes, it is slightly dramatic but, then, people do code launch vehicle control systems). I'm glad we agree. I would hope that the analyst/programmer[s] would have designed the code in such a way that it straightforwardly describes what should be done in all anticipatable circumstances. I don't think it is worth betting that ad hoc exception-handling code can cope with the "genuinely surprising condition". I think that exceptions encourage careless, lazy, analysis and programming, and produce code that is unclear and (more) difficult to reason about than traditional sequential, predicate-transforming, code. Yes, they can be used as a short-hand notation to code e.g. the rule "whenever an arithmetic overflow occurs in this section of code, I don't care; just quit (or do the calculation again with different parameters, or whatever)", but they are also used as an inadequate substitute for proper systems analysis and coding. I think that this was Rob Pike's point, with which I agree. (To counter my own argument, though, I remember reading something that - I think - Doug McIlroy wrote about error handling code in telephone exchanges; the code had been known to recover successfully from errors that the designers had not anticipated. That said, I'd rather not trust to such luck.) John A. Murdie