From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fac41,39771953fe5b2343 X-Google-Attributes: gidfac41,public X-Google-Thread: 103376,39771953fe5b2343 X-Google-Attributes: gid103376,public From: Joachim Durchholz Subject: Enforcing assertions in Eiffel Date: 1997/09/17 Message-ID: <34201D40.CF490EC0@munich.netsurf.de>#1/1 X-Deja-AN: 274061397 References: <341A7F0E.66E46566@cistron.nl> <341EABAB.41C67EA6@eiffel.com> <341fddde.0@news.uni-ulm.de> X-Priority: 3 (Normal) Newsgroups: comp.lang.eiffel,comp.lang.ada Date: 1997-09-17T00:00:00+00:00 List-Id: Joerg Rodemann wrote: > > Well, sorry to raise this topic again, we had a long discussion about > that > shortly and it's still continuing, but this seems to point to some > problems > we discussed in a concrete situation: Well, no - I can't imagine what the GPL (a *legal* contract) has to do with Eiffel assertions (a *technical* contract). > how is the Eiffel system going > to check > the usage of a class versus its specification (seems we agreed on the > term > short-flat form as a similar concept to the Ada spec.) Is the Eiffel > system > able to check against the compiled library or is it more likely to > leave that > to the linker as in C++? Eiffel assertions are predicates, which in the language context means boolean expressions. If the proper options are set at compile time these expressions will be evaluated at the appropriate time; a violated assertion will raise an exception. Needless to say that these exceptions shouldn't be called to "fix things up" in any way - what should be fixed is the code, not the execution. Of course such an exception might still be caught to prevent disaster, e.g. in an embedded system to safely shut down the machine or to fall back to some panic mode of operation, or in an interactive system to report the error and ask the user to try something different. One important side note: You can compile each class with its individual level of assertion checking (preconditions, postconditions, invariants, and a few other assertion types not relevant on the interface level). However, precondition checks are done in the caller (at least conceptually), so even if you use a library compiled with all checks off, you can still run your code with precondition checking on and you'll get exceptions if you call that library with (say) wrong parameters. Regards, Joachim -- Please don't send unsolicited ads.