Subject: Re: About the usage of throw/catch From: Erik Naggum <erik@naggum.no> Date: 2000/01/10 Newsgroups: comp.lang.lisp Message-ID: <3156499535828192@naggum.no> * arolambler@aol.com (ArolAmbler) | I also weigh in on the presumably more controversial side of even | return-from as being "dirty", not to mention a go outside of the | originating tagbody. I'd like an example of a GO outside of the "originating TAGBODY" that you consider dirty. (hint: maybe you don't know the language very well...) | The "dirtiness" arises partly from the lack of reusability of the | resulting code. reusable code is best defined as _functions_ that you can call from other bodies or code than the body of code it was originally designed to serve. reusable code is worst defined as code that can be copied (i.e., cut and paste) from one body of code to another -- yet that is what most people consider it to be, mostly because they don't have sufficiently powerful function concepts and engage in programming-by-cut-and-paste themselves. "reusable code" is nothing more than a new name for "write library code whenever you can" which is really nothing more than a way of expressing the age-old concept of "abstraction". of course, when you change focus or angle, but keep staring at the same old thing, you need a new name so the people who got disappointed the first few times won't notice the very same thing you've all been staring at. | A "clean" piece of code in any language should, ideally, never, EVER, for | ANY arguments whatsoever, do a non-local transfer of control, of any kind. and _I_ think this argument is nothing more than the extremely naïve argument used when people want 100% security or want to abolish accidents completely, and then they go hunting for someone to sue whenever a security violation or an accident happens, as if nature itself offended them by not submitting to their wishful thinking. the answer to such folly as "if only the world were ideal..." is simply: "if only the ideals were wordly...". I'm not afraid to implement what I think will have an ideal _interface_ using whatever dirty tricks are _necessary_ (but none beyond that, of course). I don't _want_ people to peek inside my function bodies and reuse the code with cut and paste, nor do I want people to fuck with the code so there will be hundreds of incompatible versions hacked on by people who have no regard for the abstract task it was designed to perform -- I want people to call the function when they can and call me if they can't. the desire to abolish accidents is _highly_ irrational. the same goes for the desire never to see "dirty" code. what it means is that somebody else should pay an enormous price for the wishful thinking to come true, which is quite typical of irrational political desires. for some reason, the United States is the only country on earth where accidents don't happen -- it's always somebody's fault, and you can sue that somebody for _neglect_. the same goes for "dirty" code -- if you have to code so verbosely that you can't finish typing in finite time, that's somehow better than using a safe mechanism for non-local transfer of control -- and the result is the same as the litigous American society: people lose the ability to deal with the exceptional that is still within the normal. this is not to say that certain tasks cannot be written in some "ideal" way according to some otherwordly school of thought, but the belief that anybody uses non-local transfer of control _wantonly_ is offensive to any competent craftsmen. #:Erik