On Fri, 14 Mar 2003 15:40:38 +0900 Friedrich Dominicus <frido / q-software-solutions.com> wrote: <snip> > What are the flaws, in fact I would argue the should be used > exclusivly and have some major advantages. Actually, I've gone back and looked over some material on DBC again. From what I'm reading, I was _definitely_ wrong, and take back what I said about DBC design. At least from my current understanding of it, I'm finding I agree with at least major portions of the concept. Here's one place I'm going from: http://archive.eiffel.com/doc/manuals/technology/contract/ Last time I looked at DBC it was not with regard to Eiffel, and I must have confused it with other bits I found disagreeable. Actually, I've been pondering something similar, but from a Lisp point of view, where you can basically say the same kind of thing... a variable is going to be of some type, within a certain range, etc. I wrote a module for type checking already, and have been considering syntax for range checking, but this looks like a more flexible route. > - documentation > - separting normal control flow from "Exceptions" I'm not sure what these refer to. > Using Exceptions for all kine of errors which can happen definitly > flawed. <snip> Now here I disagree. Using exceptions for errors allows you to consolidate checking and handling code, which alone is worth the effort. Checking for an error condition after every call is impractical, and thus error conditions are glossed over, leading to bugs. Exceptions allow all conditions to get through and be handled if necessary. Using them for pre/postcondition checking just follows... if you fail, say, a precondition, raising an exception with that specific information is more useful than a simple abort. I advocate complete programmatic knowledge of the program itself. That is, if it exists, you should be able to query it. If a function takes a type of parameter (or extending this to DBC, has a certain precondition), you should be able to ask what it takes. Likewise, if there is an error condition, the code should be aware of it. There are very cool things you get from being able to do this, and a simple abort defeats the point. -- Ryan Pavlik <rpav / users.sf.net> "And, as a result, I have about as much business on a sea going vessel as a pretty unicorn princess." - 8BT